diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 670f9828cc16..40b3f441380e 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -17,7 +17,7 @@ /sdk/core/ @alzimmermsft @jianghaolu @srnagar @hemanttanwar @anuchandy /sdk/core/azure-core-tracing-opentelemetry/ @samvaity @alzimmermsft /sdk/cosmos/ @moderakh @kushagraThapar @David-Noble-at-work @kirankumarkolli @mbhaskar -/sdk/cosmos/azure-spring-data-cosmosdb/ @kushagraThapar +/sdk/cosmos/azure-spring-data-cosmos/ @kushagraThapar @saragluna @yiliuTo @chenrujun @zhoufenqin @jialindai /sdk/eventhubs/ @conniey @srnagar @mssfang /sdk/formrecognizer/ @samvaity @mssfang @sima-zhu /sdk/identity/ @schaabs @g2vinay @jianghaolu @@ -27,7 +27,7 @@ /sdk/servicebus/ @yvgopal @nemakam @hemanttanwar @conniey /sdk/storage/ @amishra-dev @rickle-msft @jaschrep-msft @gapra-msft @alzimmermsft @sima-zhu /sdk/textanalytics/ @samvaity @mssfang @sima-zhu -/sdk/spring/ @saragluna @yiliuTo @chenrujun @jialindai +/sdk/spring/ @saragluna @yiliuTo @chenrujun @zhoufenqin @jialindai # end to end tests /sdk/e2e/ @jianghaolu @g2vinay diff --git a/.gitignore b/.gitignore index b95a70475b31..8071d0f700c3 100644 --- a/.gitignore +++ b/.gitignore @@ -68,3 +68,4 @@ package-lock.json # VS Code .vscode/ .factorypath +jacoco.exec diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 43e86e06b205..80be7a0bc41e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -87,6 +87,22 @@ Some live tests may have additional steps for setting up live testing resources. See the CONTRIBUTING.md file for the service you wish to test for additional information or instructions. +### Workaround for Checkstyle error + +When building locally you might run into a Checkstyle such as the following: + +``` +Execution default of goal org.apache.maven.plugins:maven-checkstyle-plugin:3.1.0:check failed: +Plugin org.apache.maven.plugins:maven-checkstyle-plugin:3.1.0 or one of its dependencies could not be resolved: +Could not find artifact com.azure:sdk-build-tools:jar:1.0.0 in ossrh (https://oss.sonatype.org/content/repositories/snapshots/) +``` + +This is because the `sdk-build-tools` project isn't released to Maven. To resolve this issue you'll need to copy the `eng` folder locally then install `sdk-build-tools`. + +`mvn clean install eng/code-quality-reports/pom.xml` + +All code in the Azure SDKs for Java repository must pass Checkstyle before being merged. The `sdk-build-tools` is updated periodically, so if a new branch fails Checkstyle you'll need to reinstall. + ## Versions and versioning Tooling has been introduced to centralize versioning and help ease the pain of updating artifact versions in POM and README files. Under the eng\versioning directory there exists version text files, one for client ([version_client.txt](./eng/versioning/version_client.txt)) and one for data ([version_data.txt](./eng/versioning/version_data.txt)). The format of the version files is as follows: 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 11048593d743..ae6c3fffe457 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 @@ -417,6 +417,8 @@ + + @@ -472,9 +474,9 @@ + files="com.azure.spring.data.cosmos.config.AbstractCosmosConfiguration.java"/> + files="com.azure.spring.data.cosmos.core.query.CosmosPageRequest.java"/> @@ -483,9 +485,9 @@ - - - - + + + + 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 20d914254b04..e5f86b0a9328 100644 --- a/eng/code-quality-reports/src/main/resources/revapi/revapi.json +++ b/eng/code-quality-reports/src/main/resources/revapi/revapi.json @@ -16,7 +16,9 @@ "com\\.microsoft\\.spring\\..+", "javax\\.jms(\\..+)?", "javax\\.servlet(\\..+)?", - "io\\.micrometer(\\..+)?" + "io\\.micrometer(\\..+)?", + "com\\.azure\\.data\\.cosmos(\\..+)?", + "com\\.azure\\.spring\\.data\\.cosmos\\..+" ] } } diff --git a/eng/common/Update-Change-Log.ps1 b/eng/common/Update-Change-Log.ps1 index d50316f223b7..a819a05e8bb2 100644 --- a/eng/common/Update-Change-Log.ps1 +++ b/eng/common/Update-Change-Log.ps1 @@ -27,10 +27,10 @@ function Get-ChangelogPath($Path) { # Check if CHANGELOG.md is present in path $ChangeLogPath = Join-Path -Path $Path -ChildPath "CHANGELOG.md" - if ((Test-Path -Path $ChangeLogPath) -eq $False){ + if ((Test-Path -Path $ChangeLogPath) -eq $False) { # Check if change log exists with name HISTORY.md $ChangeLogPath = Join-Path -Path $Path -ChildPath "HISTORY.md" - if ((Test-Path -Path $ChangeLogPath) -eq $False){ + if ((Test-Path -Path $ChangeLogPath) -eq $False) { Write-Host "Change log is not found in path[$Path]" exit(1) } @@ -45,7 +45,7 @@ function Get-VersionTitle($Version, $Unreleased) { # Generate version title $newVersionTitle = "## $Version $UNRELEASED_TAG" - if ($Unreleased -eq $False){ + if ($Unreleased -eq $False) { $releaseDate = Get-Date -Format "(yyyy-MM-dd)" $newVersionTitle = "## $Version $releaseDate" } @@ -67,10 +67,10 @@ function Get-NewChangeLog( [System.Collections.ArrayList]$ChangelogLines, $Versi # Version increment tool passes replaceversion as False and Unreleased as True $is_version_increment = $ReplaceVersion -eq $False -and $Unreleased -eq $True - for(; $Index -lt $ChangelogLines.Count; $Index++){ - if (Version-Matches($ChangelogLines[$Index])){ + for (; $Index -lt $ChangelogLines.Count; $Index++) { + if (Version-Matches($ChangelogLines[$Index])) { # Find current title in change log - if( -not $CurrentTitle){ + if( -not $CurrentTitle) { $CurrentTitle = $ChangelogLines[$Index] $CurrentIndex = $Index Write-Host "Current Version title: $CurrentTitle" @@ -80,7 +80,7 @@ function Get-NewChangeLog( [System.Collections.ArrayList]$ChangelogLines, $Versi # update change log script is triggered for all packages with current version for Java ( or any language where version is maintained in common file) # and this can cause an issue if someone changes changelog manually to prepare for release without updating actual version in central version file # Do not add new line or replace existing title when version is already present and script is triggered to add new line - if ($is_version_increment -and $ChangelogLines[$Index].Contains($Version)){ + if ($is_version_increment -and $ChangelogLines[$Index].Contains($Version)) { Write-Host "Version is already present in change log." exit(0) } @@ -90,26 +90,24 @@ function Get-NewChangeLog( [System.Collections.ArrayList]$ChangelogLines, $Versi # Generate version title $newVersionTitle = Get-VersionTitle -Version $Version -Unreleased $Unreleased - if( $newVersionTitle -eq $CurrentTitle){ + if( $newVersionTitle -eq $CurrentTitle) { Write-Host "No change is required in change log. Version is already present." exit(0) } - - - if (($ReplaceVersion -eq $True) -and ($Unreleased -eq $False) -and (-not $CurrentTitle.Contains($UNRELEASED_TAG))){ + if (($ReplaceVersion -eq $True) -and ($Unreleased -eq $False) -and $CurrentTitle.Contains($version) -and (-not $CurrentTitle.Contains($UNRELEASED_TAG))) { Write-Host "Version is already present in change log with a release date." exit(0) } # if current version title already has new version then we should replace title to update it - if ($CurrentTitle.Contains($Version) -and $ReplaceVersion -eq $False){ + if ($CurrentTitle.Contains($Version) -and $ReplaceVersion -eq $False) { Write-Host "Version is already present in title. Updating version title" $ReplaceVersion = $True } # if version is already found and not replacing then nothing to do - if ($ReplaceVersion -eq $False){ + if ($ReplaceVersion -eq $False) { Write-Host "Adding version title $newVersionTitle" $ChangelogLines.insert($CurrentIndex, "") $ChangelogLines.insert($CurrentIndex, "") @@ -121,24 +119,28 @@ function Get-NewChangeLog( [System.Collections.ArrayList]$ChangelogLines, $Versi $ChangelogLines[$CurrentIndex] = $newVersionTitle } - return $ChangelogLines + return $ChangelogLines } # Make sure path is valid -if ((Test-Path -Path $ChangeLogPath) -eq $False){ +if ((Test-Path -Path $ChangeLogPath) -eq $False) { Write-Host "Change log path is invalid. [$ChangeLogPath]" exit(1) } # probe change log path if path is directory -if (Test-Path -Path $ChangeLogPath -PathType Container) -{ +if (Test-Path -Path $ChangeLogPath -PathType Container) { $ChangeLogPath = Get-ChangelogPath -Path $ChangeLogPath } # Read current change logs and add/update version $ChangelogLines = [System.Collections.ArrayList](Get-Content -Path $ChangeLogPath) + +if ($null -eq $ChangelogLines) { + $ChangelogLines = @() +} + $NewContents = Get-NewChangeLog -ChangelogLines $ChangelogLines -Version $Version -Unreleased $Unreleased -ReplaceVersion $ReplaceVersion Write-Host "Writing change log to file [$ChangeLogPath]" diff --git a/eng/common/pipelines/templates/steps/daily-dev-build-variable.yml b/eng/common/pipelines/templates/steps/daily-dev-build-variable.yml new file mode 100644 index 000000000000..2e10f695c998 --- /dev/null +++ b/eng/common/pipelines/templates/steps/daily-dev-build-variable.yml @@ -0,0 +1,12 @@ +# This script fragment is used across our repos to set a variable "SetDevVersion" which +# is used when this pipeline is going to be generating and publishing daily dev builds. + +steps: +- pwsh: | + $setDailyDevBuild = "false" + if (('$(Build.Reason)' -eq 'Schedule') -and ('$(System.TeamProject)' -eq 'internal')) { + $setDailyDevBuild = "true" + } + echo "##vso[task.setvariable variable=SetDevVersion]$setDailyDevBuild" + displayName: "Setup Versioning Properties" + condition: eq(variables['SetDevVersion'], '') diff --git a/eng/common/pipelines/templates/steps/verify-changelog.yml b/eng/common/pipelines/templates/steps/verify-changelog.yml index 914adcc660e8..f6005124a87f 100644 --- a/eng/common/pipelines/templates/steps/verify-changelog.yml +++ b/eng/common/pipelines/templates/steps/verify-changelog.yml @@ -21,5 +21,5 @@ steps: -ForRelease $${{ parameters.ForRelease }} pwsh: true workingDirectory: $(Pipeline.Workspace) - displayName: Verify ChangeLog / Release Notes + displayName: Verify ChangeLogEntry for ${{ parameters.PackageName }} continueOnError: false \ No newline at end of file diff --git a/eng/common/scripts/Verify-ChangeLog.ps1 b/eng/common/scripts/Verify-ChangeLog.ps1 index 816a82f5bcb2..c9ad4d295644 100644 --- a/eng/common/scripts/Verify-ChangeLog.ps1 +++ b/eng/common/scripts/Verify-ChangeLog.ps1 @@ -11,21 +11,29 @@ param ( [boolean]$ForRelease=$False ) +$ProgressPreference = "SilentlyContinue" . (Join-Path $PSScriptRoot SemVer.ps1) Import-Module (Join-Path $PSScriptRoot modules ChangeLog-Operations.psm1) -if ((Test-Path $ChangeLogLocation) -and -not([System.String]::IsNullOrEmpty($VersionString))) +$validChangeLog = $false +if ($ChangeLogLocation -and $VersionString) { - Confirm-ChangeLogEntry -ChangeLogLocation $ChangeLogLocation -VersionString $VersionString -ForRelease $ForRelease + $validChangeLog = Confirm-ChangeLogEntry -ChangeLogLocation $ChangeLogLocation -VersionString $VersionString -ForRelease $ForRelease } else { - Import-Module (Join-Path $PSScriptRoot modules Package-Properties.psm1) - if ([System.String]::IsNullOrEmpty($Language)) - { - $Language = $RepoName.Substring($RepoName.LastIndexOf('-') + 1) - } + Import-Module (Join-Path $PSScriptRoot modules Package-Properties.psm1) + if ([System.String]::IsNullOrEmpty($Language)) + { + $Language = $RepoName.Substring($RepoName.LastIndexOf('-') + 1) + } - $PackageProp = Get-PkgProperties -PackageName $PackageName -ServiceName $ServiceName -Language $Language -RepoRoot $RepoRoot - Confirm-ChangeLogEntry -ChangeLogLocation $PackageProp.pkgChangeLogPath -VersionString $PackageProp.pkgVersion -ForRelease $ForRelease -} \ No newline at end of file + $PackageProp = Get-PkgProperties -PackageName $PackageName -ServiceName $ServiceName -Language $Language -RepoRoot $RepoRoot + $validChangeLog = Confirm-ChangeLogEntry -ChangeLogLocation $PackageProp.pkgChangeLogPath -VersionString $PackageProp.pkgVersion -ForRelease $ForRelease +} + +if (!$validChangeLog) { + exit 1 +} + +exit 0 \ No newline at end of file diff --git a/eng/common/scripts/create-tags-and-git-release.ps1 b/eng/common/scripts/create-tags-and-git-release.ps1 index cec45536b704..1667cddd7e22 100644 --- a/eng/common/scripts/create-tags-and-git-release.ps1 +++ b/eng/common/scripts/create-tags-and-git-release.ps1 @@ -6,7 +6,6 @@ param ( # used by VerifyPackages $artifactLocation, # the root of the artifact folder. DevOps $(System.ArtifactsDirectory) $workingDirectory, # directory that package artifacts will be extracted into for examination (if necessary) - [ValidateSet("Nuget","NPM","PyPI","Maven")] $packageRepository, # used to indicate destination against which we will check the existing version. # valid options: PyPI, Nuget, NPM, Maven, C # used by CreateTags diff --git a/eng/common/scripts/modules/ChangeLog-Operations.psm1 b/eng/common/scripts/modules/ChangeLog-Operations.psm1 index 5c173876124e..5aed584d018b 100644 --- a/eng/common/scripts/modules/ChangeLog-Operations.psm1 +++ b/eng/common/scripts/modules/ChangeLog-Operations.psm1 @@ -11,8 +11,8 @@ function Get-ChangeLogEntries { $changeLogEntries = @{} if (!(Test-Path $ChangeLogLocation)) { - Write-Host "ChangeLog '{0}' was not found" -f $ChangeLogLocation - exit 1 + Write-Error "ChangeLog[${ChangeLogLocation}] does not exist" + return $null } try { @@ -51,14 +51,12 @@ function Get-ChangeLogEntry { [Parameter(Mandatory = $true)] [String]$VersionString ) - $changeLogEntries = Get-ChangeLogEntries -ChangeLogLocation $ChangeLogLocation - if ($changeLogEntries.ContainsKey($VersionString)) { + if ($changeLogEntries -and $changeLogEntries.ContainsKey($VersionString)) { return $changeLogEntries[$VersionString] } - Write-Error "Release Notes for the Specified version ${VersionString} was not found" - exit 1 + return $null } #Returns the changelog for a particular version as string @@ -70,9 +68,16 @@ function Get-ChangeLogEntryAsString { [String]$VersionString ) - $changeLogEntries = Get-ChangeLogEntry -ChangeLogLocation $ChangeLogLocation -VersionString $VersionString - [string]$releaseTitle = $changeLogEntries.ReleaseTitle - [string]$releaseContent = $changeLogEntries.ReleaseContent -Join [Environment]::NewLine + $changeLogEntry = Get-ChangeLogEntry -ChangeLogLocation $ChangeLogLocation -VersionString $VersionString + return ChangeLogEntryAsString $changeLogEntry +} + +function ChangeLogEntryAsString($changeLogEntry) { + if (!$changeLogEntry) { + return "[Missing change log entry]" + } + [string]$releaseTitle = $changeLogEntry.ReleaseTitle + [string]$releaseContent = $changeLogEntry.ReleaseContent -Join [Environment]::NewLine return $releaseTitle, $releaseContent -Join [Environment]::NewLine } @@ -87,28 +92,33 @@ function Confirm-ChangeLogEntry { $changeLogEntry = Get-ChangeLogEntry -ChangeLogLocation $ChangeLogLocation -VersionString $VersionString + if (!$changeLogEntry) { + Write-Error "ChangeLog[${ChangeLogLocation}] does not have an entry for version ${VersionString}." + return $false + } + + Write-Host "Found the following change log entry for version '${VersionString}' in [${ChangeLogLocation}]." + Write-Host "-----" + Write-Host (ChangeLogEntryAsString $changeLogEntry) + Write-Host "-----" + if ([System.String]::IsNullOrEmpty($changeLogEntry.ReleaseStatus)) { - Write-Host ("##[error]Changelog '{0}' has wrong release note title" -f $ChangeLogLocation) - Write-Host "##[info]Ensure the release date is included i.e. (yyyy-MM-dd) or (Unreleased) if not yet released" - exit 1 + Write-Error "Entry does not have a correct release status. Please ensure the status is set to a date '(yyyy-MM-dd)' or '(Unreleased)' if not yet released." + return $false } if ($ForRelease -eq $True) { - $CurrentDate = Get-Date -Format "yyyy-MM-dd" - if ($changeLogEntry.ReleaseStatus -ne "($CurrentDate)") { - Write-Host ("##[warning]Incorrect Date: Please use the current date in the Changelog '{0}' before releasing the package" -f $ChangeLogLocation) - exit 1 + if ($changeLogEntry.ReleaseStatus -eq "(Unreleased)") { + Write-Error "Entry has no release date set. Please ensure to set a release date with format 'yyyy-MM-dd'." + return $false } if ([System.String]::IsNullOrWhiteSpace($changeLogEntry.ReleaseContent)) { - Write-Host ("##[error]Empty Release Notes for '{0}' in '{1}'" -f $VersionString, $ChangeLogLocation) - Write-Host "##[info]Please ensure there is a release notes entry before releasing the package." - exit 1 + Write-Error "Entry has no content. Please ensure to provide some content of what changed in this version." + return $false } } - - Write-Host $changeLogEntry.ReleaseTitle - Write-Host $changeLogEntry.ReleaseContent + return $true } Export-ModuleMember -Function 'Get-ChangeLogEntries' diff --git a/eng/common/scripts/modules/Package-Properties.psm1 b/eng/common/scripts/modules/Package-Properties.psm1 index 294f6609dab8..fa6920bec349 100644 --- a/eng/common/scripts/modules/Package-Properties.psm1 +++ b/eng/common/scripts/modules/Package-Properties.psm1 @@ -3,13 +3,24 @@ class PackageProps { [string]$pkgName - [AzureEngSemanticVersion]$pkgVersion + [string]$pkgVersion [string]$pkgDirectoryPath [string]$pkgServiceName [string]$pkgReadMePath [string]$pkgChangeLogPath + [string]$pkgGroup - PackageProps( + PackageProps([string]$pkgName,[string]$pkgVersion,[string]$pkgDirectoryPath,[string]$pkgServiceName) + { + $this.Initialize($pkgName, $pkgVersion, $pkgDirectoryPath, $pkgServiceName) + } + + PackageProps([string]$pkgName,[string]$pkgVersion,[string]$pkgDirectoryPath,[string]$pkgServiceName,[string]$pkgGroup="") + { + $this.Initialize($pkgName, $pkgVersion, $pkgDirectoryPath, $pkgServiceName, $pkgGroup) + } + + hidden [void]Initialize( [string]$pkgName, [string]$pkgVersion, [string]$pkgDirectoryPath, @@ -17,11 +28,7 @@ class PackageProps ) { $this.pkgName = $pkgName - $this.pkgVersion = [AzureEngSemanticVersion]::ParseVersionString($pkgVersion) - if ($this.pkgVersion -eq $null) - { - Write-Error "Invalid version in $pkgDirectoryPath" - } + $this.pkgVersion = $pkgVersion $this.pkgDirectoryPath = $pkgDirectoryPath $this.pkgServiceName = $pkgServiceName @@ -43,8 +50,21 @@ class PackageProps $this.pkgChangeLogPath = $null } } + + hidden [void]Initialize( + [string]$pkgName, + [string]$pkgVersion, + [string]$pkgDirectoryPath, + [string]$pkgServiceName, + [string]$pkgGroup + ) + { + $this.Initialize($pkgName, $pkgVersion, $pkgDirectoryPath, $pkgServiceName) + $this.pkgGroup = $pkgGroup + } } +$ProgressPreference = "SilentlyContinue" Install-Module -Name powershell-yaml -RequiredVersion 0.4.1 -Force -Scope CurrentUser function Extract-PkgProps ($pkgPath, $serviceName, $pkgName, $lang) @@ -106,7 +126,7 @@ function Extract-PythonPkgProps ($pkgPath, $serviceName, $pkgName) { $setupLocation = $pkgPath.Replace('\','/') pushd $RepoRoot - $setupProps = (python -c "import scripts.devops_tasks.common_tasks; obj=scripts.devops_tasks.common_tasks.parse_setup('$setupLocation'); print('{0},{1}'.format(obj[0], obj[1]));") -split "," + $setupProps = (python -c "import sys; import os; sys.path.append(os.path.join('scripts', 'devops_tasks')); from common_tasks import parse_setup; obj=parse_setup('$setupLocation'); print('{0},{1}'.format(obj[0], obj[1]));") -split "," popd if (($setupProps -ne $null) -and ($setupProps[0] -eq $pkgName)) { @@ -126,10 +146,11 @@ function Extract-JavaPkgProps ($pkgPath, $serviceName, $pkgName) $projectData.load($projectPath) $projectPkgName = $projectData.project.artifactId $pkgVersion = $projectData.project.version + $pkgGroup = $projectData.project.groupId if ($projectPkgName -eq $pkgName) { - return [PackageProps]::new($pkgName, $pkgVersion.ToString(), $pkgPath, $serviceName) + return [PackageProps]::new($pkgName, $pkgVersion.ToString(), $pkgPath, $serviceName, $pkgGroup) } } return $null @@ -239,8 +260,14 @@ function Get-PkgListFromYml ($ciYmlPath) { $ciYmlContent = Get-Content $ciYmlPath -Raw $ciYmlObj = ConvertFrom-Yaml $ciYmlContent -Ordered - $artifactsInCI = $ciYmlObj["stages"][0]["parameters"]["Artifacts"] - + if ($ciYmlObj.Contains("stages")) + { + $artifactsInCI = $ciYmlObj["stages"][0]["parameters"]["Artifacts"] + } + elseif ($ciYmlObj.Contains("extends")) + { + $artifactsInCI = $ciYmlObj["extends"]["parameters"]["Artifacts"] + } if ($artifactsInCI -eq $null) { Write-Error "Failed to retrive package names in ci $ciYmlPath" diff --git a/eng/jacoco-test-coverage/pom.xml b/eng/jacoco-test-coverage/pom.xml index b809161b44bf..7de09b3ef763 100644 --- a/eng/jacoco-test-coverage/pom.xml +++ b/eng/jacoco-test-coverage/pom.xml @@ -39,7 +39,7 @@ com.azure azure-ai-formrecognizer - 1.0.0-beta.4 + 1.0.0-beta.5 com.azure @@ -49,7 +49,7 @@ com.azure azure-core - 1.7.0-beta.1 + 1.7.0-beta.2 com.azure @@ -79,7 +79,7 @@ com.azure azure-core-management - 1.0.0-beta.2 + 1.0.0-beta.3 com.azure @@ -174,27 +174,27 @@ com.azure azure-storage-common - 12.8.0-beta.1 + 12.8.0-beta.2 com.azure azure-storage-blob - 12.8.0-beta.1 + 12.8.0-beta.2 com.azure azure-storage-blob-batch - 12.6.0-beta.1 + 12.6.0-beta.2 com.azure azure-storage-blob-changefeed - 12.0.0-beta.1 + 12.0.0-beta.2 com.azure azure-storage-blob-cryptography - 12.8.0-beta.1 + 12.8.0-beta.2 @@ -205,22 +205,22 @@ com.azure azure-storage-file-share - 12.6.0-beta.1 + 12.6.0-beta.2 com.azure azure-storage-file-datalake - 12.2.0-beta.1 + 12.2.0-beta.2 com.azure azure-storage-internal-avro - 12.0.0-beta.1 + 12.0.0-beta.2 com.azure azure-storage-queue - 12.6.0-beta.1 + 12.6.0-beta.2 com.azure @@ -274,9 +274,9 @@ 2.3.3-beta.1 - com.microsoft.azure - spring-data-cosmosdb - 2.3.1-beta.1 + com.azure + azure-spring-data-cosmos + 3.0.0-beta.1 diff --git a/eng/pipelines/client.yml b/eng/pipelines/client.yml index 65e51ad9d8e7..b5ed0d6fc462 100644 --- a/eng/pipelines/client.yml +++ b/eng/pipelines/client.yml @@ -4,14 +4,6 @@ trigger: - master -resources: - repositories: - - repository: azure-sdk-tools - type: github - name: Azure/azure-sdk-tools - endpoint: azure - ref: refs/tags/azure-sdk-tools_20200618.1 - variables: DefaultOptions: '--batch-mode --fail-at-end -Dmaven.wagon.http.pool=false --settings eng/settings.xml' LoggingOptions: '-Dorg.slf4j.simpleLogger.defaultLogLevel=error -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn' diff --git a/eng/pipelines/docindex.yml b/eng/pipelines/docindex.yml index 89fa6c311098..add650b3cc4d 100644 --- a/eng/pipelines/docindex.yml +++ b/eng/pipelines/docindex.yml @@ -1,11 +1,3 @@ -resources: - repositories: - - repository: azure-sdk-tools - type: github - name: azure/azure-sdk-tools - ref: refs/tags/azure-sdk-tools_20200618.1 - endpoint: azure - jobs: - job: CreateDocIndex variables: @@ -18,7 +10,7 @@ jobs: inputs: versionSpec: '3.6' - - template: eng/pipelines/templates/scripts/replace-relative-links.yml@azure-sdk-tools + - template: /eng/common/pipelines/templates/steps/replace-relative-links.yml parameters: TargetFolder: . RootFolder: . @@ -39,7 +31,7 @@ jobs: displayName: 'Use Python 3.6' inputs: versionSpec: '3.6' - - template: eng/pipelines/templates/scripts/mashup-doc-index.yml@azure-sdk-tools + - template: /eng/common/pipelines/templates/steps/mashup-doc-index.yml parameters: SourceDirectory: $(Build.SourcesDirectory) - task: CopyFiles@2 diff --git a/eng/pipelines/scripts/generate_overview_from_readme.py b/eng/pipelines/scripts/generate_overview_from_readme.py index e75b3aff7519..6b606a98777c 100644 --- a/eng/pipelines/scripts/generate_overview_from_readme.py +++ b/eng/pipelines/scripts/generate_overview_from_readme.py @@ -1,10 +1,10 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -# Use case: Given a README.md file, generate a readme_overview.html file and place it next +# Use case: Given a README.md file, generate a readme_overview.html file and place it next # to the README.md. This will allow the javadocs jar step to append the contents of the # readme onto the landing page. -# +# # This script is necessary, instead of just invoking python markdown2 directly from the # command line because the generated overview.html file needs to be enclosed inside of # tags. When the attach-javadocs runs with the overview option it will append it the contents @@ -19,6 +19,7 @@ import markdown2 import os.path from io import open +import re import sys def generate_overview(readme_file, version): @@ -40,7 +41,7 @@ def generate_overview(readme_file, version): # markdown2.markdown will create html from the readme.md file. The fenced-code-blocks # extras being passed into the markdown call is necessary to deal with the embedded # code blocks within the readme so they'll displaye correctly in the html - html_readme_content = markdown2.markdown(readme_content, extras=["fenced-code-blocks"]) + html_readme_content = markdown2.markdown(re.sub(pattern='^(\s*)@', repl='\g<1>{@literal @}', string=readme_content, flags=re.MULTILINE), extras=["fenced-code-blocks"]) # Due to javadoc's iFrames the links need to target new tabs otherwise hilarity ensues soup = BeautifulSoup(html_readme_content, "html.parser") diff --git a/eng/pipelines/templates/jobs/archetype-sdk-client.yml b/eng/pipelines/templates/jobs/archetype-sdk-client.yml index 67173c57d2c4..23e1e2c3d394 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-client.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-client.yml @@ -64,7 +64,7 @@ jobs: inputs: versionSpec: '3.6' - - template: tools/daily-dev-build-variable/daily-dev-build-variable.yml@azure-sdk-tools + - template: /eng/common/pipelines/templates/steps/daily-dev-build-variable.yml - ${{ each artifact in parameters.Artifacts }}: - script: | @@ -193,7 +193,7 @@ jobs: displayName: 'Run SpotBugs, Checkstyle, RevApi, and Javadoc' inputs: mavenPomFile: pom.xml - options: '--no-transfer-progress -DskipTests -Dgpg.skip -Dverify-readme-windows -pl $(ProjectList)' + options: '$(DefaultOptions) --no-transfer-progress -DskipTests -Dgpg.skip -Dverify-readme-windows -pl $(ProjectList)' mavenOptions: '$(MemoryOptions)' javaHomeOption: 'JDKVersion' jdkVersionOption: $(JavaBuildVersion) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-data.yml b/eng/pipelines/templates/jobs/archetype-sdk-data.yml index 5a17aee93df9..c0b0eb195c5a 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-data.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-data.yml @@ -55,7 +55,7 @@ jobs: inputs: versionSpec: '3.6' - - template: tools/daily-dev-build-variable/daily-dev-build-variable.yml@azure-sdk-tools + - template: /eng/common/pipelines/templates/steps/daily-dev-build-variable.yml - ${{ each artifact in parameters.Artifacts }}: - script: | diff --git a/eng/pipelines/templates/jobs/archetype-sdk-pom-only.yml b/eng/pipelines/templates/jobs/archetype-sdk-pom-only.yml index 314aa903aae8..c912ac39997f 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-pom-only.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-pom-only.yml @@ -29,7 +29,7 @@ jobs: inputs: versionSpec: '3.6' - - template: tools/daily-dev-build-variable/daily-dev-build-variable.yml@azure-sdk-tools + - template: /eng/common/pipelines/templates/steps/daily-dev-build-variable.yml - script: | pip install setuptools wheel diff --git a/eng/pipelines/templates/stages/archetype-java-release.yml b/eng/pipelines/templates/stages/archetype-java-release.yml index 5f001f020e67..75d2006a8d74 100644 --- a/eng/pipelines/templates/stages/archetype-java-release.yml +++ b/eng/pipelines/templates/stages/archetype-java-release.yml @@ -75,11 +75,12 @@ stages: $(Build.SourcesDirectory)/eng/versioning/scan_for_unreleased_dependencies.ps1 ${{artifact.groupId}} ${{artifact.name}} $(Build.SourcesDirectory)/sdk/${{parameters.ServiceDirectory}} displayName: "Verify no unreleased dependencies" - - template: /eng/common/pipelines/templates/steps/verify-changelog.yml - parameters: - PackageName: ${{artifact.name}} - ServiceName: ${{parameters.ServiceDirectory}} - ForRelease: true + - ${{if ne(parameters.SDKType, 'data')}}: + - template: /eng/common/pipelines/templates/steps/verify-changelog.yml + parameters: + PackageName: ${{artifact.name}} + ServiceName: ${{parameters.ServiceDirectory}} + ForRelease: true - deployment: TagRepository @@ -181,8 +182,8 @@ stages: PRBranchName: 'smoke-test-rdme' ArtifactName: ${{parameters.ArtifactName}} Language: 'java' - DocRepoDestinationPath: 'docs-ref-services/' - + DocRepoDestinationPath: 'docs-ref-services/' + - ${{if ne(artifact.options.skipPublishDocs, 'true')}}: - deployment: PublishDocs displayName: Publish Docs to GitHubIO Blob Storage diff --git a/eng/pipelines/templates/stages/archetype-sdk-client.yml b/eng/pipelines/templates/stages/archetype-sdk-client.yml index dee81478fecc..3f57cf4450bd 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-client.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -4,11 +4,6 @@ resources: type: git name: internal/azure-sdk-build-tools ref: refs/tags/azure-sdk-build-tools_20200618.4 - - repository: azure-sdk-tools - type: github - name: Azure/azure-sdk-tools - endpoint: azure - ref: refs/tags/azure-sdk-tools_20200618.1 parameters: - name: Artifacts diff --git a/eng/pipelines/templates/stages/archetype-sdk-data.yml b/eng/pipelines/templates/stages/archetype-sdk-data.yml index e98003657c37..f0348c56ac18 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-data.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-data.yml @@ -4,11 +4,6 @@ resources: type: git name: internal/azure-sdk-build-tools ref: refs/tags/azure-sdk-build-tools_20200618.4 - - repository: azure-sdk-tools - type: github - name: Azure/azure-sdk-tools - endpoint: azure - ref: refs/tags/azure-sdk-tools_20200618.1 parameters: - name: Artifacts diff --git a/eng/pipelines/templates/stages/archetype-sdk-pom-only.yml b/eng/pipelines/templates/stages/archetype-sdk-pom-only.yml index dfb4a0ff6372..32fec8a1900c 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-pom-only.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-pom-only.yml @@ -4,11 +4,6 @@ resources: type: git name: internal/azure-sdk-build-tools ref: refs/tags/azure-sdk-build-tools_20200618.4 - - repository: azure-sdk-tools - type: github - name: Azure/azure-sdk-tools - endpoint: azure - ref: refs/tags/azure-sdk-tools_20200618.1 parameters: - name: Artifacts diff --git a/eng/pipelines/templates/stages/cosmos-sdk-client.yml b/eng/pipelines/templates/stages/cosmos-sdk-client.yml index 3fea2eef3eea..d31b37c199e8 100644 --- a/eng/pipelines/templates/stages/cosmos-sdk-client.yml +++ b/eng/pipelines/templates/stages/cosmos-sdk-client.yml @@ -4,11 +4,6 @@ resources: type: git name: internal/azure-sdk-build-tools ref: refs/tags/azure-sdk-build-tools_20200618.4 - - repository: azure-sdk-tools - type: github - name: Azure/azure-sdk-tools - endpoint: azure - ref: refs/tags/azure-sdk-tools_20200618.1 parameters: - name: Artifacts @@ -86,6 +81,9 @@ stages: ServiceDirectory: cosmos Artifacts: ${{ parameters.Artifacts }} AdditionalModules: ${{ parameters.AdditionalModules }} + # Increased timeout to 90 because of cosmos emulator taking 25-30 mins to download emulator + # Issue filed to improve download speed: https://github.com/Azure/azure-sdk-for-java/issues/12970 + TimeoutInMinutes: 90 Matrix: Tcp_Integration_Tests_Java8: OSVmImage: 'windows-2019' @@ -94,6 +92,7 @@ stages: DisplayName: 'Emulator only Integration Tests' PROTOCOLS: '["Tcp"]' DESIRED_CONSISTENCIES: '["Strong", "Session"]' + AdditionalArgs: '-DargLine="-DACCOUNT_HOST=https://localhost:8081/"' Https_Integration_Tests_Java8: OSVmImage: 'windows-2019' JavaTestVersion: '1.8' @@ -101,10 +100,17 @@ stages: DisplayName: 'Emulator only Integration Tests' PROTOCOLS: '["Https"]' DESIRED_CONSISTENCIES: '["Strong", "Session"]' + AdditionalArgs: '-DargLine="-DACCOUNT_HOST=https://localhost:8081/"' + Spring_Integration_Tests_Java8: + OSVmImage: 'windows-2019' + JavaTestVersion: '1.8' + ProfileFlag: '-P integration-test-emulator' + DisplayName: 'Spring Emulator only Integration Tests' + AdditionalArgs: '-DargLine="-DACCOUNT_HOST=https://localhost:8081/ -DACCOUNT_KEY=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw== -DSECONDARY_ACCOUNT_KEY=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="' TestStepMavenInputs: goals: 'verify' - options: '$(ProfileFlag) -Dgpg.skip -DargLine="-DACCOUNT_HOST=https://localhost:8081/" -pl $(ProjectList)' + options: '$(ProfileFlag) -Dgpg.skip $(AdditionalArgs) -pl $(ProjectList)' mavenAuthenticateFeed: true jdkVersionOption: $(JavaTestVersion) diff --git a/eng/pipelines/templates/variables/globals.yml b/eng/pipelines/templates/variables/globals.yml index b2bb2acb9f96..611421186b18 100644 --- a/eng/pipelines/templates/variables/globals.yml +++ b/eng/pipelines/templates/variables/globals.yml @@ -1,6 +1,7 @@ variables: DocWardenVersion: '0.5.0' - DefaultOptions: '--batch-mode --fail-at-end --settings eng/settings.xml' + WagonOptions: '-Dmaven.wagon.rto=300000 -Dmaven.wagon.http.retryHandler.count=3' + DefaultOptions: '--batch-mode --fail-at-end --settings eng/settings.xml $(WagonOptions)' LoggingOptions: '-Dorg.slf4j.simpleLogger.defaultLogLevel=error -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn' MemoryOptions: '-Xmx3072m' #Agent.Source.Git.ShallowFetchDepth: 1 diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 96713d963c8e..f3d41f3ad28e 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -4,15 +4,15 @@ 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-formrecognizer;1.0.0-beta.3;1.0.0-beta.4 -com.azure:azure-ai-textanalytics;1.0.0;1.1.0-beta.1 -com.azure:azure-core;1.6.0;1.7.0-beta.1 +com.azure:azure-ai-formrecognizer;1.0.0-beta.4;1.0.0-beta.5 +com.azure:azure-ai-textanalytics;1.0.1;1.1.0-beta.1 +com.azure:azure-core;1.7.0-beta.1;1.7.0-beta.2 com.azure:azure-core-amqp;1.3.0;1.4.0-beta.1 com.azure:azure-core-experimental;1.0.0-beta.1;1.0.0-beta.2 com.azure:azure-core-http-jdk-httpclient;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-core-http-netty;1.5.3;1.6.0-beta.1 com.azure:azure-core-http-okhttp;1.2.4;1.3.0-beta.1 -com.azure:azure-core-management;1.0.0-beta.1;1.0.0-beta.2 +com.azure:azure-core-management;1.0.0-beta.2;1.0.0-beta.3 com.azure:azure-core-serializer-avro-apache;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-core-serializer-avro-jackson;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-core-serializer-json-gson;1.0.0-beta.1;1.0.0-beta.2 @@ -21,34 +21,39 @@ com.azure:azure-core-test;1.3.1;1.4.0-beta.1 com.azure:azure-core-tracing-opentelemetry;1.0.0-beta.5;1.0.0-beta.6 com.azure:azure-cosmos;4.1.0;4.2.0-beta.1 com.azure:azure-cosmos-benchmark;4.0.1-beta.1;4.0.1-beta.1 -com.azure:azure-data-appconfiguration;1.1.2;1.2.0-beta.1 +com.azure:azure-data-appconfiguration;1.1.3;1.2.0-beta.1 com.azure:azure-data-schemaregistry;1.0.0-beta.2;1.0.0-beta.3 com.azure:azure-data-schemaregistry-avro;1.0.0-beta.2;1.0.0-beta.3 com.azure:azure-data-tables;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-e2e;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-identity;1.0.7;1.1.0-beta.6 +com.azure:azure-identity;1.0.8;1.1.0-beta.6 com.azure:azure-identity-perf;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-messaging-eventhubs;5.1.1;5.2.0-beta.1 -com.azure:azure-messaging-eventhubs-checkpointstore-blob;1.1.1;1.2.0-beta.1 +com.azure:azure-messaging-eventhubs;5.1.2;5.2.0-beta.1 +com.azure:azure-messaging-eventhubs-checkpointstore-blob;1.1.2;1.2.0-beta.1 com.azure:azure-messaging-servicebus;7.0.0-beta.3;7.0.0-beta.4 com.azure:azure-search-documents;1.0.0-beta.4;11.0.0 com.azure:azure-security-keyvault-certificates;4.0.4;4.1.0-beta.4 com.azure:azure-security-keyvault-keys;4.1.4;4.2.0-beta.5 com.azure:azure-security-keyvault-secrets;4.1.4;4.2.0-beta.4 com.azure:azure-sdk-template;1.0.4-beta.19;1.0.4-beta.20 -com.azure:azure-storage-blob;12.7.0;12.8.0-beta.1 -com.azure:azure-storage-blob-batch;12.5.2;12.6.0-beta.1 -com.azure:azure-storage-blob-changefeed;12.0.0-beta.1;12.0.0-beta.1 -com.azure:azure-storage-blob-cryptography;12.7.0;12.8.0-beta.1 +com.azure:azure-spring-data-cosmos;3.0.0-beta.1;3.0.0-beta.1 +com.azure:azure-storage-blob;12.8.0-beta.1;12.8.0-beta.2 +com.azure:azure-storage-blob-batch;12.6.0-beta.1;12.6.0-beta.2 +com.azure:azure-storage-blob-changefeed;12.0.0-beta.1;12.0.0-beta.2 +com.azure:azure-storage-blob-cryptography;12.8.0-beta.1;12.8.0-beta.2 com.azure:azure-storage-blob-nio;12.0.0-beta.1;12.0.0-beta.1 -com.azure:azure-storage-common;12.7.0;12.8.0-beta.1 -com.azure:azure-storage-file-share;12.5.0;12.6.0-beta.1 -com.azure:azure-storage-file-datalake;12.1.2;12.2.0-beta.1 -com.azure:azure-storage-internal-avro;12.0.0-beta.1;12.0.0-beta.1 +com.azure:azure-storage-common;12.8.0-beta.1;12.8.0-beta.2 +com.azure:azure-storage-file-share;12.6.0-beta.1;12.6.0-beta.2 +com.azure:azure-storage-file-datalake;12.2.0-beta.1;12.2.0-beta.2 +com.azure:azure-storage-internal-avro;12.0.0-beta.1;12.0.0-beta.2 com.azure:azure-storage-perf;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-storage-queue;12.5.2;12.6.0-beta.1 +com.azure:azure-storage-queue;12.6.0-beta.1;12.6.0-beta.2 com.azure:perf-test-core;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-test-watcher;1.0.0-beta.1;1.0.0-beta.1 +com.azure:azure-spring-boot-test-aad;1.0.0;1.0.0 +com.azure:azure-spring-boot-test-core;1.0.0;1.0.0 +com.azure:azure-spring-boot-test-cosmosdb;1.0.0;1.0.0 +com.azure:azure-spring-boot-test-keyvault;1.0.0;1.0.0 com.microsoft.azure:azure-spring-boot;2.3.2;2.3.3-beta.1 com.microsoft.azure:azure-spring-boot-starter;2.3.2;2.3.3-beta.1 com.microsoft.azure:azure-active-directory-spring-boot-starter;2.3.2;2.3.3-beta.1 @@ -58,16 +63,13 @@ com.microsoft.azure:azure-data-gremlin-spring-boot-starter;2.3.2;2.3.3-beta.1 com.microsoft.azure:azure-keyvault-secrets-spring-boot-starter;2.3.2;2.3.3-beta.1 com.microsoft.azure:azure-servicebus-jms-spring-boot-starter;2.3.2;2.3.3-beta.1 com.microsoft.azure:azure-spring-boot-metrics-starter;2.3.2;2.3.3-beta.1 -com.microsoft.azure:azure-spring-boot-tests;2.3.2;2.3.3-beta.1 -com.microsoft.azure:azure-spring-boot-test-core;2.3.2;2.3.3-beta.1 -com.microsoft.azure:spring-data-cosmosdb;2.3.0;2.3.1-beta.1 +com.microsoft.azure:spring-data-cosmosdb;3.0.0-beta.1;3.0.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current # version. Unreleased dependencies are only valid for dependency versions. # Format; # unreleased_:;dependency-version # note: The unreleased dependencies will not be manipulated with the automatic PR creation code. -unreleased_com.azure:azure-core;1.7.0-beta.1 unreleased_com.azure:azure-messaging-servicebus;7.0.0-beta.4 # Released Beta dependencies: Copy the entry from above, prepend "beta_", remove the current @@ -77,3 +79,4 @@ unreleased_com.azure:azure-messaging-servicebus;7.0.0-beta.4 # Format; # beta_:;dependency-version # note: Released beta versions will not be manipulated with the automatic PR creation code. +beta_com.azure:azure-core;1.7.0-beta.1 diff --git a/eng/versioning/version_data.txt b/eng/versioning/version_data.txt index 74a67fd21514..66633f0b3a96 100644 --- a/eng/versioning/version_data.txt +++ b/eng/versioning/version_data.txt @@ -8,7 +8,7 @@ com.microsoft.azure:azure-applicationinsights-query;1.0.0-beta-2;1.0.0-beta-2 com.microsoft.azure.cognitiveservices:azure-cognitiveservices-spellcheck;1.1.0-beta.1;1.1.0-beta.1 com.microsoft.azure.cognitiveservices:azure-cognitiveservices-textanalytics;1.1.0-beta.1;1.1.0-beta.1 com.microsoft.azure.cognitiveservices:azure-cognitiveservices-luis-runtime;1.1.0-beta.1;1.1.0-beta.1 -com.microsoft.azure.cognitiveservices:azure-cognitiveservices-luis-authoring;1.0.4-beta;1.0.4-beta +com.microsoft.azure.cognitiveservices:azure-cognitiveservices-luis-authoring;1.0.5-beta;1.0.5-beta com.microsoft.azure.cognitiveservices:azure-cognitiveservices-autosuggest;1.1.0-beta.1;1.1.0-beta.1 com.microsoft.azure.cognitiveservices:azure-cognitiveservices-customimagesearch;1.1.0-beta.1;1.1.0-beta.1 com.microsoft.azure.cognitiveservices:azure-cognitiveservices-customsearch;1.1.0-beta.1;1.1.0-beta.1 diff --git a/sdk/appconfiguration/azure-data-appconfiguration/CHANGELOG.md b/sdk/appconfiguration/azure-data-appconfiguration/CHANGELOG.md index cdaca5446469..cefee3c23522 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/CHANGELOG.md +++ b/sdk/appconfiguration/azure-data-appconfiguration/CHANGELOG.md @@ -2,6 +2,9 @@ ## 1.2.0-beta.1 (Unreleased) +## 1.1.3 (2020-07-07) +- Update dependency version, `azure-core` to 1.6.0 and `azure-core-http-netty` to 1.5.3. + ## 1.1.2 (2020-06-09) - Update dependency version, `azure-core` to 1.5.1 and `azure-core-http-netty` to 1.5.2. diff --git a/sdk/appconfiguration/azure-data-appconfiguration/README.md b/sdk/appconfiguration/azure-data-appconfiguration/README.md index 832dc3c61cdc..feee8189cf24 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/README.md +++ b/sdk/appconfiguration/azure-data-appconfiguration/README.md @@ -23,12 +23,12 @@ Use the client library for App Configuration to create and manage application co com.azure azure-data-appconfiguration - 1.1.2 + 1.1.3 ``` [//]: # ({x-version-update-end}) -### Create an App Configuration Store +#### Create an App Configuration Store To create a Configuration Store you can use the Azure Portal or [Azure CLI][azure_cli]. diff --git a/sdk/appconfiguration/azure-data-appconfiguration/pom.xml b/sdk/appconfiguration/azure-data-appconfiguration/pom.xml index be05c61b3990..dcbbf330b911 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/pom.xml +++ b/sdk/appconfiguration/azure-data-appconfiguration/pom.xml @@ -36,7 +36,7 @@ com.azure azure-core - 1.6.0 + 1.7.0-beta.1 com.azure @@ -90,7 +90,7 @@ com.azure azure-identity - 1.0.7 + 1.0.8 test diff --git a/sdk/appplatform/mgmt/.gitignore b/sdk/appplatform/mgmt/.gitignore new file mode 100644 index 000000000000..f537a954e09a --- /dev/null +++ b/sdk/appplatform/mgmt/.gitignore @@ -0,0 +1,2 @@ +/piggymetrics +# folder created in unit test diff --git a/sdk/appplatform/mgmt/pom.xml b/sdk/appplatform/mgmt/pom.xml new file mode 100644 index 000000000000..6b323b92c0cf --- /dev/null +++ b/sdk/appplatform/mgmt/pom.xml @@ -0,0 +1,139 @@ + + + 4.0.0 + + com.azure.resourcemanager + azure-resourcemanager-parent + 2.0.0-SNAPSHOT + ../../management/pom.xml + + + azure-resourcemanager-appplatform + jar + + Microsoft Azure SDK for App Platform Management + This package contains Microsoft Azure App Platform Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + UTF-8 + + + + + + microsoft + Microsoft + + + + + + com.azure.resourcemanager + azure-resourcemanager-resources + 2.0.0-SNAPSHOT + + + com.azure + azure-storage-file-share + 12.5.0 + + + org.apache.commons + commons-compress + 1.20 + + + org.junit.jupiter + junit-jupiter-engine + test + + + org.junit.jupiter + junit-jupiter-api + test + + + com.azure + azure-core-http-netty + test + + + com.azure + azure-identity + test + + + + + azure-mgmt-sdk-test-jar + + + !maven.test.skip + + + + + com.azure.resourcemanager + azure-resourcemanager-resources + 2.0.0-SNAPSHOT + test-jar + test + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + true + true + + true + true + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + + diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/AppPlatformManagementClient.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/AppPlatformManagementClient.java new file mode 100644 index 000000000000..9283a8306343 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/AppPlatformManagementClient.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.appplatform; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resources.fluentcore.AzureServiceClient; +import com.azure.resourcemanager.appplatform.fluent.AppsClient; +import com.azure.resourcemanager.appplatform.fluent.BindingsClient; +import com.azure.resourcemanager.appplatform.fluent.CertificatesClient; +import com.azure.resourcemanager.appplatform.fluent.CustomDomainsClient; +import com.azure.resourcemanager.appplatform.fluent.DeploymentsClient; +import com.azure.resourcemanager.appplatform.fluent.OperationsClient; +import com.azure.resourcemanager.appplatform.fluent.ServicesClient; +import com.azure.resourcemanager.appplatform.fluent.SkusClient; + +/** Initializes a new instance of the AppPlatformManagementClient type. */ +@ServiceClient(builder = AppPlatformManagementClientBuilder.class) +public final class AppPlatformManagementClient extends AzureServiceClient { + private final ClientLogger logger = new ClientLogger(AppPlatformManagementClient.class); + + /** + * Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of + * the URI for every service call. + */ + 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. + * + * @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 ServicesClient object to access its operations. */ + private final ServicesClient services; + + /** + * Gets the ServicesClient object to access its operations. + * + * @return the ServicesClient object. + */ + public ServicesClient getServices() { + return this.services; + } + + /** The AppsClient object to access its operations. */ + private final AppsClient apps; + + /** + * Gets the AppsClient object to access its operations. + * + * @return the AppsClient object. + */ + public AppsClient getApps() { + return this.apps; + } + + /** The BindingsClient object to access its operations. */ + private final BindingsClient bindings; + + /** + * Gets the BindingsClient object to access its operations. + * + * @return the BindingsClient object. + */ + public BindingsClient getBindings() { + return this.bindings; + } + + /** The CertificatesClient object to access its operations. */ + private final CertificatesClient certificates; + + /** + * Gets the CertificatesClient object to access its operations. + * + * @return the CertificatesClient object. + */ + public CertificatesClient getCertificates() { + return this.certificates; + } + + /** The CustomDomainsClient object to access its operations. */ + private final CustomDomainsClient customDomains; + + /** + * Gets the CustomDomainsClient object to access its operations. + * + * @return the CustomDomainsClient object. + */ + public CustomDomainsClient getCustomDomains() { + return this.customDomains; + } + + /** The DeploymentsClient object to access its operations. */ + private final DeploymentsClient deployments; + + /** + * Gets the DeploymentsClient object to access its operations. + * + * @return the DeploymentsClient object. + */ + public DeploymentsClient getDeployments() { + return this.deployments; + } + + /** 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 SkusClient object to access its operations. */ + private final SkusClient skus; + + /** + * Gets the SkusClient object to access its operations. + * + * @return the SkusClient object. + */ + public SkusClient getSkus() { + return this.skus; + } + + /** + * Initializes an instance of AppPlatformManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param environment The Azure environment. + */ + AppPlatformManagementClient( + HttpPipeline httpPipeline, AzureEnvironment environment, String subscriptionId, String endpoint) { + super(httpPipeline, environment); + this.httpPipeline = httpPipeline; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2019-05-01-preview"; + this.services = new ServicesClient(this); + this.apps = new AppsClient(this); + this.bindings = new BindingsClient(this); + this.certificates = new CertificatesClient(this); + this.customDomains = new CustomDomainsClient(this); + this.deployments = new DeploymentsClient(this); + this.operations = new OperationsClient(this); + this.skus = new SkusClient(this); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/AppPlatformManagementClientBuilder.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/AppPlatformManagementClientBuilder.java new file mode 100644 index 000000000000..fe7fcab4df6b --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/AppPlatformManagementClientBuilder.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.appplatform; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; + +/** A builder for creating a new instance of the AppPlatformManagementClient type. */ +@ServiceClientBuilder(serviceClients = {AppPlatformManagementClient.class}) +public final class AppPlatformManagementClientBuilder { + /* + * Gets subscription ID which uniquely identify the Microsoft Azure + * subscription. The subscription ID forms part of the URI for every + * service call. + */ + 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. + * + * @param subscriptionId the subscriptionId value. + * @return the AppPlatformManagementClientBuilder. + */ + public AppPlatformManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the AppPlatformManagementClientBuilder. + */ + public AppPlatformManagementClientBuilder 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 AppPlatformManagementClientBuilder. + */ + public AppPlatformManagementClientBuilder 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 AppPlatformManagementClientBuilder. + */ + public AppPlatformManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /** + * Builds an instance of AppPlatformManagementClient with the provided parameters. + * + * @return an instance of AppPlatformManagementClient. + */ + public AppPlatformManagementClient buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + AppPlatformManagementClient client = + new AppPlatformManagementClient(pipeline, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/AppPlatformManager.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/AppPlatformManager.java new file mode 100644 index 000000000000..02426a2949cd --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/AppPlatformManager.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.appplatform; + + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpPipeline; +import com.azure.resourcemanager.appplatform.implementation.SpringServicesImpl; +import com.azure.resourcemanager.appplatform.models.SpringServices; +import com.azure.resourcemanager.resources.fluentcore.arm.AzureConfigurable; +import com.azure.resourcemanager.resources.fluentcore.arm.implementation.AzureConfigurableImpl; +import com.azure.resourcemanager.resources.fluentcore.arm.implementation.Manager; +import com.azure.resourcemanager.resources.fluentcore.profile.AzureProfile; +import com.azure.resourcemanager.resources.fluentcore.utils.HttpPipelineProvider; +import com.azure.resourcemanager.resources.fluentcore.utils.SdkContext; + +/** Entry point to Azure App Platform management. */ +public final class AppPlatformManager extends Manager { + // Collections + private SpringServices springServices; + /** + * Get a Configurable instance that can be used to create AppPlatformManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new AppPlatformManager.ConfigurableImpl(); + } + + /** + * Creates an instance of AppPlatformManager that exposes app platform resource management API entry points. + * + * @param credential the credential to use + * @param profile the profile to use + * @return the AppPlatformManager + */ + public static AppPlatformManager authenticate(TokenCredential credential, AzureProfile profile) { + return authenticate(HttpPipelineProvider.buildHttpPipeline(credential, profile), profile); + } + + /** + * Creates an instance of AppPlatformManager that exposes app platform resource management API entry points. + * + * @param httpPipeline the HttpPipeline to be used for API calls. + * @param profile the profile to use + * @return the AppPlatformManager + */ + public static AppPlatformManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + return authenticate(httpPipeline, profile, new SdkContext()); + } + + /** + * Creates an instance of AppPlatformManager that exposes app platform resource management API entry points. + * + * @param httpPipeline the HttpPipeline to be used for API calls. + * @param profile the profile to use + * @param sdkContext the sdk context + * @return the AppPlatformManager + */ + public static AppPlatformManager authenticate( + HttpPipeline httpPipeline, AzureProfile profile, SdkContext sdkContext) { + return new AppPlatformManager(httpPipeline, profile, sdkContext); + } + + /** The interface allowing configurations to be set. */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of AppPlatformManager that exposes app platform resource management API entry points. + * + * @param credential the credential to use + * @param profile the profile to use + * @return the interface exposing AppPlatform management API entry points that work across subscriptions + */ + AppPlatformManager authenticate(TokenCredential credential, AzureProfile profile); + } + + /** The implementation for Configurable interface. */ + private static final class ConfigurableImpl extends AzureConfigurableImpl implements Configurable { + public AppPlatformManager authenticate(TokenCredential credential, AzureProfile profile) { + return AppPlatformManager.authenticate(buildHttpPipeline(credential, profile), profile); + } + } + + private AppPlatformManager(HttpPipeline httpPipeline, AzureProfile profile, SdkContext sdkContext) { + super( + httpPipeline, + profile, + new AppPlatformManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.environment().getResourceManagerEndpoint()) + .subscriptionId(profile.subscriptionId()) + .buildClient(), + sdkContext); + } + + /** @return Entry point for Spring Service management API. */ + public SpringServices springServices() { + if (springServices == null) { + springServices = new SpringServicesImpl(this); + } + return springServices; + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/AppsClient.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/AppsClient.java new file mode 100644 index 000000000000..7e392b21bc22 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/AppsClient.java @@ -0,0 +1,1577 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.appplatform.fluent; + +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.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.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.appplatform.AppPlatformManagementClient; +import com.azure.resourcemanager.appplatform.fluent.inner.AppResourceCollectionInner; +import com.azure.resourcemanager.appplatform.fluent.inner.AppResourceInner; +import com.azure.resourcemanager.appplatform.models.ResourceUploadDefinition; +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 Apps. */ +public final class AppsClient { + private final ClientLogger logger = new ClientLogger(AppsClient.class); + + /** The proxy service used to perform REST calls. */ + private final AppsService service; + + /** The service client containing this operation class. */ + private final AppPlatformManagementClient client; + + /** + * Initializes an instance of AppsClient. + * + * @param client the instance of the service client containing this operation class. + */ + public AppsClient(AppPlatformManagementClient client) { + this.service = RestProxy.create(AppsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AppPlatformManagementClientApps to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AppPlatformManagemen") + private interface AppsService { + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/apps/{appName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("appName") String appName, + @QueryParam("syncStatus") String syncStatus, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/apps/{appName}") + @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("serviceName") String serviceName, + @PathParam("appName") String appName, + @BodyParam("application/json") AppResourceInner appResource, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/apps/{appName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("appName") String appName, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/apps/{appName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("appName") String appName, + @BodyParam("application/json") AppResourceInner appResource, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/apps") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/apps/{appName}/getResourceUploadUrl") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getResourceUploadUrl( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("appName") String appName, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, Context context); + } + + /** + * Get an App 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 serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param syncStatus Indicates whether sync status. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 App and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String resourceGroupName, String serviceName, String appName, String syncStatus) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + syncStatus, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get an App 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 serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param syncStatus Indicates whether sync status. + * @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 App and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String resourceGroupName, String serviceName, String appName, String syncStatus, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + syncStatus, + context); + } + + /** + * Get an App 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 serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param syncStatus Indicates whether sync status. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 App and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync( + String resourceGroupName, String serviceName, String appName, String syncStatus) { + return getWithResponseAsync(resourceGroupName, serviceName, appName, syncStatus) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get an App 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 serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param syncStatus Indicates whether sync status. + * @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 App and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync( + String resourceGroupName, String serviceName, String appName, String syncStatus, Context context) { + return getWithResponseAsync(resourceGroupName, serviceName, appName, syncStatus, context) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get an App 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 serviceName The name of the Service resource. + * @param appName The name of the App 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 an App and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync(String resourceGroupName, String serviceName, String appName) { + final String syncStatus = null; + final Context context = null; + return getWithResponseAsync(resourceGroupName, serviceName, appName, syncStatus) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get an App 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 serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param syncStatus Indicates whether sync status. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 App and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AppResourceInner get(String resourceGroupName, String serviceName, String appName, String syncStatus) { + return getAsync(resourceGroupName, serviceName, appName, syncStatus).block(); + } + + /** + * Get an App 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 serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param syncStatus Indicates whether sync status. + * @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 App and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AppResourceInner get( + String resourceGroupName, String serviceName, String appName, String syncStatus, Context context) { + return getAsync(resourceGroupName, serviceName, appName, syncStatus, context).block(); + } + + /** + * Get an App 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 serviceName The name of the Service resource. + * @param appName The name of the App 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 an App and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AppResourceInner get(String resourceGroupName, String serviceName, String appName) { + final String syncStatus = null; + final Context context = null; + return getAsync(resourceGroupName, serviceName, appName, syncStatus).block(); + } + + /** + * Create a new App or update an exiting App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param appResource App resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return app resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serviceName, String appName, AppResourceInner appResource) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (appResource == null) { + return Mono.error(new IllegalArgumentException("Parameter appResource is required and cannot be null.")); + } else { + appResource.validate(); + } + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + appResource, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create a new App or update an exiting App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param appResource App resource payload. + * @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 app resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serviceName, String appName, AppResourceInner appResource, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (appResource == null) { + return Mono.error(new IllegalArgumentException("Parameter appResource is required and cannot be null.")); + } else { + appResource.validate(); + } + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + appResource, + context); + } + + /** + * Create a new App or update an exiting App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param appResource App resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return app resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PollerFlux, AppResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serviceName, String appName, AppResourceInner appResource) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serviceName, appName, appResource); + return this + .client + .getLroResultAsync( + mono, this.client.getHttpPipeline(), AppResourceInner.class, AppResourceInner.class); + } + + /** + * Create a new App or update an exiting App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param appResource App resource payload. + * @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 app resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PollerFlux, AppResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serviceName, String appName, AppResourceInner appResource, Context context) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serviceName, appName, appResource, context); + return this + .client + .getLroResultAsync( + mono, this.client.getHttpPipeline(), AppResourceInner.class, AppResourceInner.class); + } + + /** + * Create a new App or update an exiting App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param appResource App resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return app resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, AppResourceInner> beginCreateOrUpdate( + String resourceGroupName, String serviceName, String appName, AppResourceInner appResource) { + return beginCreateOrUpdateAsync(resourceGroupName, serviceName, appName, appResource).getSyncPoller(); + } + + /** + * Create a new App or update an exiting App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param appResource App resource payload. + * @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 app resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, AppResourceInner> beginCreateOrUpdate( + String resourceGroupName, String serviceName, String appName, AppResourceInner appResource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serviceName, appName, appResource, context).getSyncPoller(); + } + + /** + * Create a new App or update an exiting App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param appResource App resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return app resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync( + String resourceGroupName, String serviceName, String appName, AppResourceInner appResource) { + return beginCreateOrUpdateAsync(resourceGroupName, serviceName, appName, appResource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a new App or update an exiting App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param appResource App resource payload. + * @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 app resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync( + String resourceGroupName, String serviceName, String appName, AppResourceInner appResource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serviceName, appName, appResource, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a new App or update an exiting App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param appResource App resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return app resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AppResourceInner createOrUpdate( + String resourceGroupName, String serviceName, String appName, AppResourceInner appResource) { + return createOrUpdateAsync(resourceGroupName, serviceName, appName, appResource).block(); + } + + /** + * Create a new App or update an exiting App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param appResource App resource payload. + * @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 app resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AppResourceInner createOrUpdate( + String resourceGroupName, String serviceName, String appName, AppResourceInner appResource, Context context) { + return createOrUpdateAsync(resourceGroupName, serviceName, appName, appResource, context).block(); + } + + /** + * Operation to delete an App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync(String resourceGroupName, String serviceName, String appName) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Operation to delete an App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync( + String resourceGroupName, String serviceName, String appName, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + context); + } + + /** + * Operation to delete an App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAsync(String resourceGroupName, String serviceName, String appName) { + return deleteWithResponseAsync(resourceGroupName, serviceName, appName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Operation to delete an App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAsync(String resourceGroupName, String serviceName, String appName, Context context) { + return deleteWithResponseAsync(resourceGroupName, serviceName, appName, context) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Operation to delete an App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serviceName, String appName) { + deleteAsync(resourceGroupName, serviceName, appName).block(); + } + + /** + * Operation to delete an App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serviceName, String appName, Context context) { + deleteAsync(resourceGroupName, serviceName, appName, context).block(); + } + + /** + * Operation to update an exiting App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param appResource App resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return app resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> updateWithResponseAsync( + String resourceGroupName, String serviceName, String appName, AppResourceInner appResource) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (appResource == null) { + return Mono.error(new IllegalArgumentException("Parameter appResource is required and cannot be null.")); + } else { + appResource.validate(); + } + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + appResource, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Operation to update an exiting App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param appResource App resource payload. + * @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 app resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> updateWithResponseAsync( + String resourceGroupName, String serviceName, String appName, AppResourceInner appResource, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (appResource == null) { + return Mono.error(new IllegalArgumentException("Parameter appResource is required and cannot be null.")); + } else { + appResource.validate(); + } + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + appResource, + context); + } + + /** + * Operation to update an exiting App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param appResource App resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return app resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PollerFlux, AppResourceInner> beginUpdateAsync( + String resourceGroupName, String serviceName, String appName, AppResourceInner appResource) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serviceName, appName, appResource); + return this + .client + .getLroResultAsync( + mono, this.client.getHttpPipeline(), AppResourceInner.class, AppResourceInner.class); + } + + /** + * Operation to update an exiting App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param appResource App resource payload. + * @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 app resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PollerFlux, AppResourceInner> beginUpdateAsync( + String resourceGroupName, String serviceName, String appName, AppResourceInner appResource, Context context) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serviceName, appName, appResource, context); + return this + .client + .getLroResultAsync( + mono, this.client.getHttpPipeline(), AppResourceInner.class, AppResourceInner.class); + } + + /** + * Operation to update an exiting App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param appResource App resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return app resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, AppResourceInner> beginUpdate( + String resourceGroupName, String serviceName, String appName, AppResourceInner appResource) { + return beginUpdateAsync(resourceGroupName, serviceName, appName, appResource).getSyncPoller(); + } + + /** + * Operation to update an exiting App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param appResource App resource payload. + * @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 app resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, AppResourceInner> beginUpdate( + String resourceGroupName, String serviceName, String appName, AppResourceInner appResource, Context context) { + return beginUpdateAsync(resourceGroupName, serviceName, appName, appResource, context).getSyncPoller(); + } + + /** + * Operation to update an exiting App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param appResource App resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return app resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateAsync( + String resourceGroupName, String serviceName, String appName, AppResourceInner appResource) { + return beginUpdateAsync(resourceGroupName, serviceName, appName, appResource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Operation to update an exiting App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param appResource App resource payload. + * @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 app resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateAsync( + String resourceGroupName, String serviceName, String appName, AppResourceInner appResource, Context context) { + return beginUpdateAsync(resourceGroupName, serviceName, appName, appResource, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Operation to update an exiting App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param appResource App resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return app resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AppResourceInner update( + String resourceGroupName, String serviceName, String appName, AppResourceInner appResource) { + return updateAsync(resourceGroupName, serviceName, appName, appResource).block(); + } + + /** + * Operation to update an exiting App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param appResource App resource payload. + * @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 app resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AppResourceInner update( + String resourceGroupName, String serviceName, String appName, AppResourceInner appResource, Context context) { + return updateAsync(resourceGroupName, serviceName, appName, appResource, context).block(); + } + + /** + * Handles requests to list all resources in a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listSinglePageAsync(String resourceGroupName, String serviceName) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Handles requests to list all resources in a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listSinglePageAsync( + String resourceGroupName, String serviceName, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Handles requests to list all resources in a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync(String resourceGroupName, String serviceName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, serviceName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Handles requests to list all resources in a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync(String resourceGroupName, String serviceName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, serviceName, context), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Handles requests to list all resources in a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serviceName) { + return new PagedIterable<>(listAsync(resourceGroupName, serviceName)); + } + + /** + * Handles requests to list all resources in a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serviceName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, serviceName, context)); + } + + /** + * Get an resource upload URL for an App, which may be artifacts or source archive. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App 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 an resource upload URL for an App, which may be artifacts or source archive. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getResourceUploadUrlWithResponseAsync( + String resourceGroupName, String serviceName, String appName) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .getResourceUploadUrl( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get an resource upload URL for an App, which may be artifacts or source archive. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App 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 an resource upload URL for an App, which may be artifacts or source archive. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getResourceUploadUrlWithResponseAsync( + String resourceGroupName, String serviceName, String appName, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + return service + .getResourceUploadUrl( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + context); + } + + /** + * Get an resource upload URL for an App, which may be artifacts or source archive. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App 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 an resource upload URL for an App, which may be artifacts or source archive. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getResourceUploadUrlAsync( + String resourceGroupName, String serviceName, String appName) { + return getResourceUploadUrlWithResponseAsync(resourceGroupName, serviceName, appName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get an resource upload URL for an App, which may be artifacts or source archive. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App 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 an resource upload URL for an App, which may be artifacts or source archive. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getResourceUploadUrlAsync( + String resourceGroupName, String serviceName, String appName, Context context) { + return getResourceUploadUrlWithResponseAsync(resourceGroupName, serviceName, appName, context) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get an resource upload URL for an App, which may be artifacts or source archive. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App 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 an resource upload URL for an App, which may be artifacts or source archive. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourceUploadDefinition getResourceUploadUrl(String resourceGroupName, String serviceName, String appName) { + return getResourceUploadUrlAsync(resourceGroupName, serviceName, appName).block(); + } + + /** + * Get an resource upload URL for an App, which may be artifacts or source archive. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App 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 an resource upload URL for an App, which may be artifacts or source archive. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourceUploadDefinition getResourceUploadUrl( + String resourceGroupName, String serviceName, String appName, Context context) { + return getResourceUploadUrlAsync(resourceGroupName, serviceName, appName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + return FluxUtil + .withContext(context -> service.listNext(nextLink, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + return service + .listNext(nextLink, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/BindingsClient.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/BindingsClient.java new file mode 100644 index 000000000000..9a10fb6f6cdf --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/BindingsClient.java @@ -0,0 +1,1296 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.appplatform.fluent; + +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.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.appplatform.AppPlatformManagementClient; +import com.azure.resourcemanager.appplatform.fluent.inner.BindingResourceCollectionInner; +import com.azure.resourcemanager.appplatform.fluent.inner.BindingResourceInner; +import com.azure.resourcemanager.appplatform.models.BindingResourceProperties; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in Bindings. */ +public final class BindingsClient { + private final ClientLogger logger = new ClientLogger(BindingsClient.class); + + /** The proxy service used to perform REST calls. */ + private final BindingsService service; + + /** The service client containing this operation class. */ + private final AppPlatformManagementClient client; + + /** + * Initializes an instance of BindingsClient. + * + * @param client the instance of the service client containing this operation class. + */ + public BindingsClient(AppPlatformManagementClient client) { + this.service = RestProxy.create(BindingsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AppPlatformManagementClientBindings to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AppPlatformManagemen") + private interface BindingsService { + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/apps/{appName}/bindings/{bindingName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("appName") String appName, + @PathParam("bindingName") String bindingName, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/apps/{appName}/bindings/{bindingName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("appName") String appName, + @PathParam("bindingName") String bindingName, + @BodyParam("application/json") BindingResourceInner bindingResource, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/apps/{appName}/bindings/{bindingName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("appName") String appName, + @PathParam("bindingName") String bindingName, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/apps/{appName}/bindings/{bindingName}") + @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("serviceName") String serviceName, + @PathParam("appName") String appName, + @PathParam("bindingName") String bindingName, + @BodyParam("application/json") BindingResourceInner bindingResource, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/apps/{appName}/bindings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("appName") String appName, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, Context context); + } + + /** + * Get a Binding 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 serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param bindingName The name of the Binding 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 a Binding and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String resourceGroupName, String serviceName, String appName, String bindingName) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (bindingName == null) { + return Mono.error(new IllegalArgumentException("Parameter bindingName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + bindingName, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get a Binding 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 serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param bindingName The name of the Binding 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 a Binding and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String resourceGroupName, String serviceName, String appName, String bindingName, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (bindingName == null) { + return Mono.error(new IllegalArgumentException("Parameter bindingName is required and cannot be null.")); + } + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + bindingName, + context); + } + + /** + * Get a Binding 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 serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param bindingName The name of the Binding 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 a Binding and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync( + String resourceGroupName, String serviceName, String appName, String bindingName) { + return getWithResponseAsync(resourceGroupName, serviceName, appName, bindingName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a Binding 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 serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param bindingName The name of the Binding 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 a Binding and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync( + String resourceGroupName, String serviceName, String appName, String bindingName, Context context) { + return getWithResponseAsync(resourceGroupName, serviceName, appName, bindingName, context) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a Binding 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 serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param bindingName The name of the Binding 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 a Binding and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BindingResourceInner get(String resourceGroupName, String serviceName, String appName, String bindingName) { + return getAsync(resourceGroupName, serviceName, appName, bindingName).block(); + } + + /** + * Get a Binding 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 serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param bindingName The name of the Binding 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 a Binding and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BindingResourceInner get( + String resourceGroupName, String serviceName, String appName, String bindingName, Context context) { + return getAsync(resourceGroupName, serviceName, appName, bindingName, context).block(); + } + + /** + * Create a new Binding or update an exiting Binding. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param bindingName The name of the Binding resource. + * @param properties Binding resource properties payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return binding resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serviceName, + String appName, + String bindingName, + BindingResourceProperties 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (bindingName == null) { + return Mono.error(new IllegalArgumentException("Parameter bindingName is required and cannot be null.")); + } + if (properties != null) { + properties.validate(); + } + BindingResourceInner bindingResource = new BindingResourceInner(); + bindingResource.withProperties(properties); + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + bindingName, + bindingResource, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create a new Binding or update an exiting Binding. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param bindingName The name of the Binding resource. + * @param properties Binding resource properties payload. + * @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 binding resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serviceName, + String appName, + String bindingName, + BindingResourceProperties 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (bindingName == null) { + return Mono.error(new IllegalArgumentException("Parameter bindingName is required and cannot be null.")); + } + if (properties != null) { + properties.validate(); + } + BindingResourceInner bindingResource = new BindingResourceInner(); + bindingResource.withProperties(properties); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + bindingName, + bindingResource, + context); + } + + /** + * Create a new Binding or update an exiting Binding. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param bindingName The name of the Binding resource. + * @param properties Binding resource properties payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return binding resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync( + String resourceGroupName, + String serviceName, + String appName, + String bindingName, + BindingResourceProperties properties) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, appName, bindingName, properties) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create a new Binding or update an exiting Binding. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param bindingName The name of the Binding resource. + * @param properties Binding resource properties payload. + * @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 binding resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync( + String resourceGroupName, + String serviceName, + String appName, + String bindingName, + BindingResourceProperties properties, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serviceName, appName, bindingName, properties, context) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create a new Binding or update an exiting Binding. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param bindingName The name of the Binding resource. + * @param properties Binding resource properties payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return binding resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BindingResourceInner createOrUpdate( + String resourceGroupName, + String serviceName, + String appName, + String bindingName, + BindingResourceProperties properties) { + return createOrUpdateAsync(resourceGroupName, serviceName, appName, bindingName, properties).block(); + } + + /** + * Create a new Binding or update an exiting Binding. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param bindingName The name of the Binding resource. + * @param properties Binding resource properties payload. + * @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 binding resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BindingResourceInner createOrUpdate( + String resourceGroupName, + String serviceName, + String appName, + String bindingName, + BindingResourceProperties properties, + Context context) { + return createOrUpdateAsync(resourceGroupName, serviceName, appName, bindingName, properties, context).block(); + } + + /** + * Operation to delete a Binding. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param bindingName The name of the Binding 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync( + String resourceGroupName, String serviceName, String appName, String bindingName) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (bindingName == null) { + return Mono.error(new IllegalArgumentException("Parameter bindingName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + bindingName, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Operation to delete a Binding. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param bindingName The name of the Binding 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync( + String resourceGroupName, String serviceName, String appName, String bindingName, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (bindingName == null) { + return Mono.error(new IllegalArgumentException("Parameter bindingName is required and cannot be null.")); + } + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + bindingName, + context); + } + + /** + * Operation to delete a Binding. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param bindingName The name of the Binding 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAsync(String resourceGroupName, String serviceName, String appName, String bindingName) { + return deleteWithResponseAsync(resourceGroupName, serviceName, appName, bindingName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Operation to delete a Binding. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param bindingName The name of the Binding 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAsync( + String resourceGroupName, String serviceName, String appName, String bindingName, Context context) { + return deleteWithResponseAsync(resourceGroupName, serviceName, appName, bindingName, context) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Operation to delete a Binding. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param bindingName The name of the Binding 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serviceName, String appName, String bindingName) { + deleteAsync(resourceGroupName, serviceName, appName, bindingName).block(); + } + + /** + * Operation to delete a Binding. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param bindingName The name of the Binding 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String serviceName, String appName, String bindingName, Context context) { + deleteAsync(resourceGroupName, serviceName, appName, bindingName, context).block(); + } + + /** + * Operation to update an exiting Binding. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param bindingName The name of the Binding resource. + * @param properties Binding resource properties payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return binding resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponseAsync( + String resourceGroupName, + String serviceName, + String appName, + String bindingName, + BindingResourceProperties 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (bindingName == null) { + return Mono.error(new IllegalArgumentException("Parameter bindingName is required and cannot be null.")); + } + if (properties != null) { + properties.validate(); + } + BindingResourceInner bindingResource = new BindingResourceInner(); + bindingResource.withProperties(properties); + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + bindingName, + bindingResource, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Operation to update an exiting Binding. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param bindingName The name of the Binding resource. + * @param properties Binding resource properties payload. + * @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 binding resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponseAsync( + String resourceGroupName, + String serviceName, + String appName, + String bindingName, + BindingResourceProperties 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (bindingName == null) { + return Mono.error(new IllegalArgumentException("Parameter bindingName is required and cannot be null.")); + } + if (properties != null) { + properties.validate(); + } + BindingResourceInner bindingResource = new BindingResourceInner(); + bindingResource.withProperties(properties); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + bindingName, + bindingResource, + context); + } + + /** + * Operation to update an exiting Binding. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param bindingName The name of the Binding resource. + * @param properties Binding resource properties payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return binding resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateAsync( + String resourceGroupName, + String serviceName, + String appName, + String bindingName, + BindingResourceProperties properties) { + return updateWithResponseAsync(resourceGroupName, serviceName, appName, bindingName, properties) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Operation to update an exiting Binding. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param bindingName The name of the Binding resource. + * @param properties Binding resource properties payload. + * @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 binding resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateAsync( + String resourceGroupName, + String serviceName, + String appName, + String bindingName, + BindingResourceProperties properties, + Context context) { + return updateWithResponseAsync(resourceGroupName, serviceName, appName, bindingName, properties, context) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Operation to update an exiting Binding. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param bindingName The name of the Binding resource. + * @param properties Binding resource properties payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return binding resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BindingResourceInner update( + String resourceGroupName, + String serviceName, + String appName, + String bindingName, + BindingResourceProperties properties) { + return updateAsync(resourceGroupName, serviceName, appName, bindingName, properties).block(); + } + + /** + * Operation to update an exiting Binding. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param bindingName The name of the Binding resource. + * @param properties Binding resource properties payload. + * @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 binding resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BindingResourceInner update( + String resourceGroupName, + String serviceName, + String appName, + String bindingName, + BindingResourceProperties properties, + Context context) { + return updateAsync(resourceGroupName, serviceName, appName, bindingName, properties, context).block(); + } + + /** + * Handles requests to list all resources in an App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App 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 object that includes an array of Binding resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listSinglePageAsync( + String resourceGroupName, String serviceName, String appName) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Handles requests to list all resources in an App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App 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 object that includes an array of Binding resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listSinglePageAsync( + String resourceGroupName, String serviceName, String appName, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Handles requests to list all resources in an App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App 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 object that includes an array of Binding resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync(String resourceGroupName, String serviceName, String appName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, serviceName, appName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Handles requests to list all resources in an App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App 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 object that includes an array of Binding resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync( + String resourceGroupName, String serviceName, String appName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, serviceName, appName, context), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Handles requests to list all resources in an App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App 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 object that includes an array of Binding resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serviceName, String appName) { + return new PagedIterable<>(listAsync(resourceGroupName, serviceName, appName)); + } + + /** + * Handles requests to list all resources in an App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App 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 object that includes an array of Binding resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String serviceName, String appName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, serviceName, appName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 object that includes an array of Binding resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + return FluxUtil + .withContext(context -> service.listNext(nextLink, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 object that includes an array of Binding resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + return service + .listNext(nextLink, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/CertificatesClient.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/CertificatesClient.java new file mode 100644 index 000000000000..5a1853b7f415 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/CertificatesClient.java @@ -0,0 +1,956 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.appplatform.fluent; + +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.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.appplatform.AppPlatformManagementClient; +import com.azure.resourcemanager.appplatform.fluent.inner.CertificateResourceCollectionInner; +import com.azure.resourcemanager.appplatform.fluent.inner.CertificateResourceInner; +import com.azure.resourcemanager.appplatform.models.CertificateProperties; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in Certificates. */ +public final class CertificatesClient { + private final ClientLogger logger = new ClientLogger(CertificatesClient.class); + + /** The proxy service used to perform REST calls. */ + private final CertificatesService service; + + /** The service client containing this operation class. */ + private final AppPlatformManagementClient client; + + /** + * Initializes an instance of CertificatesClient. + * + * @param client the instance of the service client containing this operation class. + */ + public CertificatesClient(AppPlatformManagementClient client) { + this.service = + RestProxy.create(CertificatesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AppPlatformManagementClientCertificates to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AppPlatformManagemen") + private interface CertificatesService { + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/certificates/{certificateName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("certificateName") String certificateName, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/certificates/{certificateName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("certificateName") String certificateName, + @BodyParam("application/json") CertificateResourceInner certificateResource, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/certificates/{certificateName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("certificateName") String certificateName, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/certificates") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, Context context); + } + + /** + * Get the certificate 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 serviceName The name of the Service resource. + * @param certificateName The name of the certificate 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 certificate resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String resourceGroupName, String serviceName, String certificateName) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + certificateName, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the certificate 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 serviceName The name of the Service resource. + * @param certificateName The name of the certificate 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 certificate resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String resourceGroupName, String serviceName, String certificateName, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + certificateName, + context); + } + + /** + * Get the certificate 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 serviceName The name of the Service resource. + * @param certificateName The name of the certificate 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 certificate resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync( + String resourceGroupName, String serviceName, String certificateName) { + return getWithResponseAsync(resourceGroupName, serviceName, certificateName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the certificate 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 serviceName The name of the Service resource. + * @param certificateName The name of the certificate 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 certificate resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync( + String resourceGroupName, String serviceName, String certificateName, Context context) { + return getWithResponseAsync(resourceGroupName, serviceName, certificateName, context) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the certificate 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 serviceName The name of the Service resource. + * @param certificateName The name of the certificate 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 certificate resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateResourceInner get(String resourceGroupName, String serviceName, String certificateName) { + return getAsync(resourceGroupName, serviceName, certificateName).block(); + } + + /** + * Get the certificate 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 serviceName The name of the Service resource. + * @param certificateName The name of the certificate 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 certificate resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateResourceInner get( + String resourceGroupName, String serviceName, String certificateName, Context context) { + return getAsync(resourceGroupName, serviceName, certificateName, context).block(); + } + + /** + * Create or update certificate 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 serviceName The name of the Service resource. + * @param certificateName The name of the certificate resource. + * @param properties Certificate resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return certificate resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String serviceName, String certificateName, CertificateProperties 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (properties != null) { + properties.validate(); + } + CertificateResourceInner certificateResource = new CertificateResourceInner(); + certificateResource.withProperties(properties); + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + certificateName, + certificateResource, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update certificate 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 serviceName The name of the Service resource. + * @param certificateName The name of the certificate resource. + * @param properties Certificate resource payload. + * @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 certificate resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serviceName, + String certificateName, + CertificateProperties 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (properties != null) { + properties.validate(); + } + CertificateResourceInner certificateResource = new CertificateResourceInner(); + certificateResource.withProperties(properties); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + certificateName, + certificateResource, + context); + } + + /** + * Create or update certificate 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 serviceName The name of the Service resource. + * @param certificateName The name of the certificate resource. + * @param properties Certificate resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return certificate resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync( + String resourceGroupName, String serviceName, String certificateName, CertificateProperties properties) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, certificateName, properties) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or update certificate 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 serviceName The name of the Service resource. + * @param certificateName The name of the certificate resource. + * @param properties Certificate resource payload. + * @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 certificate resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync( + String resourceGroupName, + String serviceName, + String certificateName, + CertificateProperties properties, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, certificateName, properties, context) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or update certificate 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 serviceName The name of the Service resource. + * @param certificateName The name of the certificate resource. + * @param properties Certificate resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return certificate resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateResourceInner createOrUpdate( + String resourceGroupName, String serviceName, String certificateName, CertificateProperties properties) { + return createOrUpdateAsync(resourceGroupName, serviceName, certificateName, properties).block(); + } + + /** + * Create or update certificate 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 serviceName The name of the Service resource. + * @param certificateName The name of the certificate resource. + * @param properties Certificate resource payload. + * @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 certificate resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateResourceInner createOrUpdate( + String resourceGroupName, + String serviceName, + String certificateName, + CertificateProperties properties, + Context context) { + return createOrUpdateAsync(resourceGroupName, serviceName, certificateName, properties, context).block(); + } + + /** + * Delete the certificate 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 serviceName The name of the Service resource. + * @param certificateName The name of the certificate 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync( + String resourceGroupName, String serviceName, String certificateName) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + certificateName, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete the certificate 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 serviceName The name of the Service resource. + * @param certificateName The name of the certificate 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync( + String resourceGroupName, String serviceName, String certificateName, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + certificateName, + context); + } + + /** + * Delete the certificate 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 serviceName The name of the Service resource. + * @param certificateName The name of the certificate 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAsync(String resourceGroupName, String serviceName, String certificateName) { + return deleteWithResponseAsync(resourceGroupName, serviceName, certificateName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete the certificate 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 serviceName The name of the Service resource. + * @param certificateName The name of the certificate 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAsync( + String resourceGroupName, String serviceName, String certificateName, Context context) { + return deleteWithResponseAsync(resourceGroupName, serviceName, certificateName, context) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete the certificate 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 serviceName The name of the Service resource. + * @param certificateName The name of the certificate 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serviceName, String certificateName) { + deleteAsync(resourceGroupName, serviceName, certificateName).block(); + } + + /** + * Delete the certificate 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 serviceName The name of the Service resource. + * @param certificateName The name of the certificate 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serviceName, String certificateName, Context context) { + deleteAsync(resourceGroupName, serviceName, certificateName, context).block(); + } + + /** + * List all the certificates of one user. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 collection compose of certificate resources list and a possible link for next page. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listSinglePageAsync( + String resourceGroupName, String serviceName) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List all the certificates of one user. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 collection compose of certificate resources list and a possible link for next page. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listSinglePageAsync( + String resourceGroupName, String serviceName, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all the certificates of one user. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 collection compose of certificate resources list and a possible link for next page. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync(String resourceGroupName, String serviceName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, serviceName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List all the certificates of one user. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 collection compose of certificate resources list and a possible link for next page. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync( + String resourceGroupName, String serviceName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, serviceName, context), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List all the certificates of one user. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 collection compose of certificate resources list and a possible link for next page. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serviceName) { + return new PagedIterable<>(listAsync(resourceGroupName, serviceName)); + } + + /** + * List all the certificates of one user. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 collection compose of certificate resources list and a possible link for next page. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serviceName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, serviceName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 collection compose of certificate resources list and a possible link for next page. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + return FluxUtil + .withContext(context -> service.listNext(nextLink, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 collection compose of certificate resources list and a possible link for next page. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + return service + .listNext(nextLink, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/CustomDomainsClient.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/CustomDomainsClient.java new file mode 100644 index 000000000000..bf62bebbb1a7 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/CustomDomainsClient.java @@ -0,0 +1,1526 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.appplatform.fluent; + +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.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.appplatform.AppPlatformManagementClient; +import com.azure.resourcemanager.appplatform.fluent.inner.CustomDomainResourceCollectionInner; +import com.azure.resourcemanager.appplatform.fluent.inner.CustomDomainResourceInner; +import com.azure.resourcemanager.appplatform.fluent.inner.CustomDomainValidateResultInner; +import com.azure.resourcemanager.appplatform.models.CustomDomainProperties; +import com.azure.resourcemanager.appplatform.models.CustomDomainValidatePayload; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CustomDomains. */ +public final class CustomDomainsClient { + private final ClientLogger logger = new ClientLogger(CustomDomainsClient.class); + + /** The proxy service used to perform REST calls. */ + private final CustomDomainsService service; + + /** The service client containing this operation class. */ + private final AppPlatformManagementClient client; + + /** + * Initializes an instance of CustomDomainsClient. + * + * @param client the instance of the service client containing this operation class. + */ + public CustomDomainsClient(AppPlatformManagementClient client) { + this.service = + RestProxy.create(CustomDomainsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AppPlatformManagementClientCustomDomains to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AppPlatformManagemen") + private interface CustomDomainsService { + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/apps/{appName}/domains/{domainName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("appName") String appName, + @PathParam("domainName") String domainName, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/apps/{appName}/domains/{domainName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("appName") String appName, + @PathParam("domainName") String domainName, + @BodyParam("application/json") CustomDomainResourceInner domainResource, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/apps/{appName}/domains/{domainName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("appName") String appName, + @PathParam("domainName") String domainName, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/apps/{appName}/domains/{domainName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> patch( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("appName") String appName, + @PathParam("domainName") String domainName, + @BodyParam("application/json") CustomDomainResourceInner domainResource, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/apps/{appName}/domains") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("appName") String appName, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/apps/{appName}/domains/validate") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> validate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("appName") String appName, + @BodyParam("application/json") CustomDomainValidatePayload validatePayload, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, Context context); + } + + /** + * Get the custom domain of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param domainName The name of the custom domain 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 custom domain of one lifecycle application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String resourceGroupName, String serviceName, String appName, String domainName) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (domainName == null) { + return Mono.error(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + domainName, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the custom domain of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param domainName The name of the custom domain 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 custom domain of one lifecycle application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String resourceGroupName, String serviceName, String appName, String domainName, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (domainName == null) { + return Mono.error(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + domainName, + context); + } + + /** + * Get the custom domain of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param domainName The name of the custom domain 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 custom domain of one lifecycle application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync( + String resourceGroupName, String serviceName, String appName, String domainName) { + return getWithResponseAsync(resourceGroupName, serviceName, appName, domainName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the custom domain of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param domainName The name of the custom domain 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 custom domain of one lifecycle application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync( + String resourceGroupName, String serviceName, String appName, String domainName, Context context) { + return getWithResponseAsync(resourceGroupName, serviceName, appName, domainName, context) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the custom domain of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param domainName The name of the custom domain 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 custom domain of one lifecycle application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomDomainResourceInner get( + String resourceGroupName, String serviceName, String appName, String domainName) { + return getAsync(resourceGroupName, serviceName, appName, domainName).block(); + } + + /** + * Get the custom domain of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param domainName The name of the custom domain 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 custom domain of one lifecycle application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomDomainResourceInner get( + String resourceGroupName, String serviceName, String appName, String domainName, Context context) { + return getAsync(resourceGroupName, serviceName, appName, domainName, context).block(); + } + + /** + * Create or update custom domain of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param domainName The name of the custom domain resource. + * @param properties Custom domain of app resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom domain resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serviceName, + String appName, + String domainName, + CustomDomainProperties 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (domainName == null) { + return Mono.error(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + if (properties != null) { + properties.validate(); + } + CustomDomainResourceInner domainResource = new CustomDomainResourceInner(); + domainResource.withProperties(properties); + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + domainName, + domainResource, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update custom domain of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param domainName The name of the custom domain resource. + * @param properties Custom domain of app resource payload. + * @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 custom domain resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serviceName, + String appName, + String domainName, + CustomDomainProperties 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (domainName == null) { + return Mono.error(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + if (properties != null) { + properties.validate(); + } + CustomDomainResourceInner domainResource = new CustomDomainResourceInner(); + domainResource.withProperties(properties); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + domainName, + domainResource, + context); + } + + /** + * Create or update custom domain of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param domainName The name of the custom domain resource. + * @param properties Custom domain of app resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom domain resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync( + String resourceGroupName, + String serviceName, + String appName, + String domainName, + CustomDomainProperties properties) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, appName, domainName, properties) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or update custom domain of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param domainName The name of the custom domain resource. + * @param properties Custom domain of app resource payload. + * @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 custom domain resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync( + String resourceGroupName, + String serviceName, + String appName, + String domainName, + CustomDomainProperties properties, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, appName, domainName, properties, context) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or update custom domain of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param domainName The name of the custom domain resource. + * @param properties Custom domain of app resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom domain resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomDomainResourceInner createOrUpdate( + String resourceGroupName, + String serviceName, + String appName, + String domainName, + CustomDomainProperties properties) { + return createOrUpdateAsync(resourceGroupName, serviceName, appName, domainName, properties).block(); + } + + /** + * Create or update custom domain of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param domainName The name of the custom domain resource. + * @param properties Custom domain of app resource payload. + * @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 custom domain resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomDomainResourceInner createOrUpdate( + String resourceGroupName, + String serviceName, + String appName, + String domainName, + CustomDomainProperties properties, + Context context) { + return createOrUpdateAsync(resourceGroupName, serviceName, appName, domainName, properties, context).block(); + } + + /** + * Delete the custom domain of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param domainName The name of the custom domain 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync( + String resourceGroupName, String serviceName, String appName, String domainName) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (domainName == null) { + return Mono.error(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + domainName, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete the custom domain of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param domainName The name of the custom domain 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync( + String resourceGroupName, String serviceName, String appName, String domainName, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (domainName == null) { + return Mono.error(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + domainName, + context); + } + + /** + * Delete the custom domain of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param domainName The name of the custom domain 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAsync(String resourceGroupName, String serviceName, String appName, String domainName) { + return deleteWithResponseAsync(resourceGroupName, serviceName, appName, domainName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete the custom domain of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param domainName The name of the custom domain 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAsync( + String resourceGroupName, String serviceName, String appName, String domainName, Context context) { + return deleteWithResponseAsync(resourceGroupName, serviceName, appName, domainName, context) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete the custom domain of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param domainName The name of the custom domain 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serviceName, String appName, String domainName) { + deleteAsync(resourceGroupName, serviceName, appName, domainName).block(); + } + + /** + * Delete the custom domain of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param domainName The name of the custom domain 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String serviceName, String appName, String domainName, Context context) { + deleteAsync(resourceGroupName, serviceName, appName, domainName, context).block(); + } + + /** + * Update custom domain of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param domainName The name of the custom domain resource. + * @param properties Custom domain of app resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom domain resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchWithResponseAsync( + String resourceGroupName, + String serviceName, + String appName, + String domainName, + CustomDomainProperties 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (domainName == null) { + return Mono.error(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + if (properties != null) { + properties.validate(); + } + CustomDomainResourceInner domainResource = new CustomDomainResourceInner(); + domainResource.withProperties(properties); + return FluxUtil + .withContext( + context -> + service + .patch( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + domainName, + domainResource, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update custom domain of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param domainName The name of the custom domain resource. + * @param properties Custom domain of app resource payload. + * @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 custom domain resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchWithResponseAsync( + String resourceGroupName, + String serviceName, + String appName, + String domainName, + CustomDomainProperties 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (domainName == null) { + return Mono.error(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + if (properties != null) { + properties.validate(); + } + CustomDomainResourceInner domainResource = new CustomDomainResourceInner(); + domainResource.withProperties(properties); + return service + .patch( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + domainName, + domainResource, + context); + } + + /** + * Update custom domain of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param domainName The name of the custom domain resource. + * @param properties Custom domain of app resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom domain resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono patchAsync( + String resourceGroupName, + String serviceName, + String appName, + String domainName, + CustomDomainProperties properties) { + return patchWithResponseAsync(resourceGroupName, serviceName, appName, domainName, properties) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update custom domain of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param domainName The name of the custom domain resource. + * @param properties Custom domain of app resource payload. + * @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 custom domain resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono patchAsync( + String resourceGroupName, + String serviceName, + String appName, + String domainName, + CustomDomainProperties properties, + Context context) { + return patchWithResponseAsync(resourceGroupName, serviceName, appName, domainName, properties, context) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update custom domain of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param domainName The name of the custom domain resource. + * @param properties Custom domain of app resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom domain resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomDomainResourceInner patch( + String resourceGroupName, + String serviceName, + String appName, + String domainName, + CustomDomainProperties properties) { + return patchAsync(resourceGroupName, serviceName, appName, domainName, properties).block(); + } + + /** + * Update custom domain of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param domainName The name of the custom domain resource. + * @param properties Custom domain of app resource payload. + * @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 custom domain resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomDomainResourceInner patch( + String resourceGroupName, + String serviceName, + String appName, + String domainName, + CustomDomainProperties properties, + Context context) { + return patchAsync(resourceGroupName, serviceName, appName, domainName, properties, context).block(); + } + + /** + * List the custom domains of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App 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 collection compose of a custom domain resources list and a possible link for next page. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listSinglePageAsync( + String resourceGroupName, String serviceName, String appName) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List the custom domains of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App 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 collection compose of a custom domain resources list and a possible link for next page. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listSinglePageAsync( + String resourceGroupName, String serviceName, String appName, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the custom domains of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App 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 collection compose of a custom domain resources list and a possible link for next page. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync( + String resourceGroupName, String serviceName, String appName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, serviceName, appName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the custom domains of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App 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 collection compose of a custom domain resources list and a possible link for next page. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync( + String resourceGroupName, String serviceName, String appName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, serviceName, appName, context), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the custom domains of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App 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 collection compose of a custom domain resources list and a possible link for next page. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serviceName, String appName) { + return new PagedIterable<>(listAsync(resourceGroupName, serviceName, appName)); + } + + /** + * List the custom domains of one lifecycle application. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App 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 collection compose of a custom domain resources list and a possible link for next page. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String serviceName, String appName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, serviceName, appName, context)); + } + + /** + * Check the resource name is valid as well as not in use. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param name Name to be validated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return validation result for custom domain. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> validateWithResponseAsync( + String resourceGroupName, String serviceName, String appName, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + CustomDomainValidatePayload validatePayload = new CustomDomainValidatePayload(); + validatePayload.withName(name); + return FluxUtil + .withContext( + context -> + service + .validate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + validatePayload, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Check the resource name is valid as well as not in use. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param name Name to be validated. + * @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 validation result for custom domain. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> validateWithResponseAsync( + String resourceGroupName, String serviceName, String appName, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + CustomDomainValidatePayload validatePayload = new CustomDomainValidatePayload(); + validatePayload.withName(name); + return service + .validate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + validatePayload, + context); + } + + /** + * Check the resource name is valid as well as not in use. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param name Name to be validated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return validation result for custom domain. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono validateAsync( + String resourceGroupName, String serviceName, String appName, String name) { + return validateWithResponseAsync(resourceGroupName, serviceName, appName, name) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Check the resource name is valid as well as not in use. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param name Name to be validated. + * @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 validation result for custom domain. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono validateAsync( + String resourceGroupName, String serviceName, String appName, String name, Context context) { + return validateWithResponseAsync(resourceGroupName, serviceName, appName, name, context) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Check the resource name is valid as well as not in use. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param name Name to be validated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return validation result for custom domain. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomDomainValidateResultInner validate( + String resourceGroupName, String serviceName, String appName, String name) { + return validateAsync(resourceGroupName, serviceName, appName, name).block(); + } + + /** + * Check the resource name is valid as well as not in use. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param name Name to be validated. + * @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 validation result for custom domain. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomDomainValidateResultInner validate( + String resourceGroupName, String serviceName, String appName, String name, Context context) { + return validateAsync(resourceGroupName, serviceName, appName, name, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 collection compose of a custom domain resources list and a possible link for next page. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + return FluxUtil + .withContext(context -> service.listNext(nextLink, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 collection compose of a custom domain resources list and a possible link for next page. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + return service + .listNext(nextLink, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/DeploymentsClient.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/DeploymentsClient.java new file mode 100644 index 000000000000..47fed40a9026 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/DeploymentsClient.java @@ -0,0 +1,2960 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.appplatform.fluent; + +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.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.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.CollectionFormat; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.resourcemanager.appplatform.AppPlatformManagementClient; +import com.azure.resourcemanager.appplatform.fluent.inner.DeploymentResourceCollectionInner; +import com.azure.resourcemanager.appplatform.fluent.inner.DeploymentResourceInner; +import com.azure.resourcemanager.appplatform.fluent.inner.LogFileUrlResponseInner; +import com.azure.resourcemanager.appplatform.models.DeploymentResourceProperties; +import java.nio.ByteBuffer; +import java.util.List; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in Deployments. */ +public final class DeploymentsClient { + private final ClientLogger logger = new ClientLogger(DeploymentsClient.class); + + /** The proxy service used to perform REST calls. */ + private final DeploymentsService service; + + /** The service client containing this operation class. */ + private final AppPlatformManagementClient client; + + /** + * Initializes an instance of DeploymentsClient. + * + * @param client the instance of the service client containing this operation class. + */ + public DeploymentsClient(AppPlatformManagementClient client) { + this.service = + RestProxy.create(DeploymentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AppPlatformManagementClientDeployments to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AppPlatformManagemen") + private interface DeploymentsService { + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/apps/{appName}/deployments/{deploymentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("appName") String appName, + @PathParam("deploymentName") String deploymentName, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/apps/{appName}/deployments/{deploymentName}") + @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("serviceName") String serviceName, + @PathParam("appName") String appName, + @PathParam("deploymentName") String deploymentName, + @BodyParam("application/json") DeploymentResourceInner deploymentResource, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/apps/{appName}/deployments/{deploymentName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("appName") String appName, + @PathParam("deploymentName") String deploymentName, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/apps/{appName}/deployments/{deploymentName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("appName") String appName, + @PathParam("deploymentName") String deploymentName, + @BodyParam("application/json") DeploymentResourceInner deploymentResource, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/apps/{appName}/deployments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("appName") String appName, + @QueryParam("version") String version, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/deployments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listClusterAllDeployments( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @QueryParam("version") String version, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/apps/{appName}/deployments/{deploymentName}/start") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> start( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("appName") String appName, + @PathParam("deploymentName") String deploymentName, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> stop( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("appName") String appName, + @PathParam("deploymentName") String deploymentName, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> restart( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("appName") String appName, + @PathParam("deploymentName") String deploymentName, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getLogFileUrl( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("appName") String appName, + @PathParam("deploymentName") String deploymentName, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listClusterAllDeploymentsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, Context context); + } + + /** + * Get a Deployment 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 serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 a Deployment and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + deploymentName, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get a Deployment 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 serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 a Deployment and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + deploymentName, + context); + } + + /** + * Get a Deployment 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 serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 a Deployment and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName) { + return getWithResponseAsync(resourceGroupName, serviceName, appName, deploymentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a Deployment 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 serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 a Deployment and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName, Context context) { + return getWithResponseAsync(resourceGroupName, serviceName, appName, deploymentName, context) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a Deployment 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 serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 a Deployment and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentResourceInner get( + String resourceGroupName, String serviceName, String appName, String deploymentName) { + return getAsync(resourceGroupName, serviceName, appName, deploymentName).block(); + } + + /** + * Get a Deployment 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 serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 a Deployment and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentResourceInner get( + String resourceGroupName, String serviceName, String appName, String deploymentName, Context context) { + return getAsync(resourceGroupName, serviceName, appName, deploymentName, context).block(); + } + + /** + * Create a new Deployment or update an exiting Deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment resource. + * @param properties Deployment resource properties payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return deployment resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serviceName, + String appName, + String deploymentName, + DeploymentResourceProperties 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + if (properties != null) { + properties.validate(); + } + DeploymentResourceInner deploymentResource = new DeploymentResourceInner(); + deploymentResource.withProperties(properties); + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + deploymentName, + deploymentResource, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create a new Deployment or update an exiting Deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment resource. + * @param properties Deployment resource properties payload. + * @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 deployment resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serviceName, + String appName, + String deploymentName, + DeploymentResourceProperties 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + if (properties != null) { + properties.validate(); + } + DeploymentResourceInner deploymentResource = new DeploymentResourceInner(); + deploymentResource.withProperties(properties); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + deploymentName, + deploymentResource, + context); + } + + /** + * Create a new Deployment or update an exiting Deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment resource. + * @param properties Deployment resource properties payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return deployment resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PollerFlux, DeploymentResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serviceName, + String appName, + String deploymentName, + DeploymentResourceProperties properties) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serviceName, appName, deploymentName, properties); + return this + .client + .getLroResultAsync( + mono, this.client.getHttpPipeline(), DeploymentResourceInner.class, DeploymentResourceInner.class); + } + + /** + * Create a new Deployment or update an exiting Deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment resource. + * @param properties Deployment resource properties payload. + * @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 deployment resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PollerFlux, DeploymentResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serviceName, + String appName, + String deploymentName, + DeploymentResourceProperties properties, + Context context) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serviceName, appName, deploymentName, properties, context); + return this + .client + .getLroResultAsync( + mono, this.client.getHttpPipeline(), DeploymentResourceInner.class, DeploymentResourceInner.class); + } + + /** + * Create a new Deployment or update an exiting Deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment resource. + * @param properties Deployment resource properties payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return deployment resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DeploymentResourceInner> beginCreateOrUpdate( + String resourceGroupName, + String serviceName, + String appName, + String deploymentName, + DeploymentResourceProperties properties) { + return beginCreateOrUpdateAsync(resourceGroupName, serviceName, appName, deploymentName, properties) + .getSyncPoller(); + } + + /** + * Create a new Deployment or update an exiting Deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment resource. + * @param properties Deployment resource properties payload. + * @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 deployment resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DeploymentResourceInner> beginCreateOrUpdate( + String resourceGroupName, + String serviceName, + String appName, + String deploymentName, + DeploymentResourceProperties properties, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serviceName, appName, deploymentName, properties, context) + .getSyncPoller(); + } + + /** + * Create a new Deployment or update an exiting Deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment resource. + * @param properties Deployment resource properties payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return deployment resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync( + String resourceGroupName, + String serviceName, + String appName, + String deploymentName, + DeploymentResourceProperties properties) { + return beginCreateOrUpdateAsync(resourceGroupName, serviceName, appName, deploymentName, properties) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a new Deployment or update an exiting Deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment resource. + * @param properties Deployment resource properties payload. + * @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 deployment resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync( + String resourceGroupName, + String serviceName, + String appName, + String deploymentName, + DeploymentResourceProperties properties, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serviceName, appName, deploymentName, properties, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a new Deployment or update an exiting Deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment resource. + * @param properties Deployment resource properties payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return deployment resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentResourceInner createOrUpdate( + String resourceGroupName, + String serviceName, + String appName, + String deploymentName, + DeploymentResourceProperties properties) { + return createOrUpdateAsync(resourceGroupName, serviceName, appName, deploymentName, properties).block(); + } + + /** + * Create a new Deployment or update an exiting Deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment resource. + * @param properties Deployment resource properties payload. + * @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 deployment resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentResourceInner createOrUpdate( + String resourceGroupName, + String serviceName, + String appName, + String deploymentName, + DeploymentResourceProperties properties, + Context context) { + return createOrUpdateAsync(resourceGroupName, serviceName, appName, deploymentName, properties, context) + .block(); + } + + /** + * Operation to delete a Deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + deploymentName, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Operation to delete a Deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + deploymentName, + context); + } + + /** + * Operation to delete a Deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAsync(String resourceGroupName, String serviceName, String appName, String deploymentName) { + return deleteWithResponseAsync(resourceGroupName, serviceName, appName, deploymentName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Operation to delete a Deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName, Context context) { + return deleteWithResponseAsync(resourceGroupName, serviceName, appName, deploymentName, context) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Operation to delete a Deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serviceName, String appName, String deploymentName) { + deleteAsync(resourceGroupName, serviceName, appName, deploymentName).block(); + } + + /** + * Operation to delete a Deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String serviceName, String appName, String deploymentName, Context context) { + deleteAsync(resourceGroupName, serviceName, appName, deploymentName, context).block(); + } + + /** + * Operation to update an exiting Deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment resource. + * @param properties Deployment resource properties payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return deployment resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> updateWithResponseAsync( + String resourceGroupName, + String serviceName, + String appName, + String deploymentName, + DeploymentResourceProperties 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + if (properties != null) { + properties.validate(); + } + DeploymentResourceInner deploymentResource = new DeploymentResourceInner(); + deploymentResource.withProperties(properties); + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + deploymentName, + deploymentResource, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Operation to update an exiting Deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment resource. + * @param properties Deployment resource properties payload. + * @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 deployment resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> updateWithResponseAsync( + String resourceGroupName, + String serviceName, + String appName, + String deploymentName, + DeploymentResourceProperties 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + if (properties != null) { + properties.validate(); + } + DeploymentResourceInner deploymentResource = new DeploymentResourceInner(); + deploymentResource.withProperties(properties); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + deploymentName, + deploymentResource, + context); + } + + /** + * Operation to update an exiting Deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment resource. + * @param properties Deployment resource properties payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return deployment resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PollerFlux, DeploymentResourceInner> beginUpdateAsync( + String resourceGroupName, + String serviceName, + String appName, + String deploymentName, + DeploymentResourceProperties properties) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serviceName, appName, deploymentName, properties); + return this + .client + .getLroResultAsync( + mono, this.client.getHttpPipeline(), DeploymentResourceInner.class, DeploymentResourceInner.class); + } + + /** + * Operation to update an exiting Deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment resource. + * @param properties Deployment resource properties payload. + * @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 deployment resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PollerFlux, DeploymentResourceInner> beginUpdateAsync( + String resourceGroupName, + String serviceName, + String appName, + String deploymentName, + DeploymentResourceProperties properties, + Context context) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serviceName, appName, deploymentName, properties, context); + return this + .client + .getLroResultAsync( + mono, this.client.getHttpPipeline(), DeploymentResourceInner.class, DeploymentResourceInner.class); + } + + /** + * Operation to update an exiting Deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment resource. + * @param properties Deployment resource properties payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return deployment resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DeploymentResourceInner> beginUpdate( + String resourceGroupName, + String serviceName, + String appName, + String deploymentName, + DeploymentResourceProperties properties) { + return beginUpdateAsync(resourceGroupName, serviceName, appName, deploymentName, properties).getSyncPoller(); + } + + /** + * Operation to update an exiting Deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment resource. + * @param properties Deployment resource properties payload. + * @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 deployment resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DeploymentResourceInner> beginUpdate( + String resourceGroupName, + String serviceName, + String appName, + String deploymentName, + DeploymentResourceProperties properties, + Context context) { + return beginUpdateAsync(resourceGroupName, serviceName, appName, deploymentName, properties, context) + .getSyncPoller(); + } + + /** + * Operation to update an exiting Deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment resource. + * @param properties Deployment resource properties payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return deployment resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateAsync( + String resourceGroupName, + String serviceName, + String appName, + String deploymentName, + DeploymentResourceProperties properties) { + return beginUpdateAsync(resourceGroupName, serviceName, appName, deploymentName, properties) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Operation to update an exiting Deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment resource. + * @param properties Deployment resource properties payload. + * @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 deployment resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateAsync( + String resourceGroupName, + String serviceName, + String appName, + String deploymentName, + DeploymentResourceProperties properties, + Context context) { + return beginUpdateAsync(resourceGroupName, serviceName, appName, deploymentName, properties, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Operation to update an exiting Deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment resource. + * @param properties Deployment resource properties payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return deployment resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentResourceInner update( + String resourceGroupName, + String serviceName, + String appName, + String deploymentName, + DeploymentResourceProperties properties) { + return updateAsync(resourceGroupName, serviceName, appName, deploymentName, properties).block(); + } + + /** + * Operation to update an exiting Deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment resource. + * @param properties Deployment resource properties payload. + * @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 deployment resource payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentResourceInner update( + String resourceGroupName, + String serviceName, + String appName, + String deploymentName, + DeploymentResourceProperties properties, + Context context) { + return updateAsync(resourceGroupName, serviceName, appName, deploymentName, properties, context).block(); + } + + /** + * Handles requests to list all resources in an App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param version Array of Get5ItemsItem. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listSinglePageAsync( + String resourceGroupName, String serviceName, String appName, List version) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + String versionConverted = + JacksonAdapter.createDefaultSerializerAdapter().serializeList(version, CollectionFormat.CSV); + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + versionConverted, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Handles requests to list all resources in an App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param version Array of Get5ItemsItem. + * @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 object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listSinglePageAsync( + String resourceGroupName, String serviceName, String appName, List version, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + String versionConverted = + JacksonAdapter.createDefaultSerializerAdapter().serializeList(version, CollectionFormat.CSV); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + versionConverted, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Handles requests to list all resources in an App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param version Array of Get5ItemsItem. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync( + String resourceGroupName, String serviceName, String appName, List version) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, serviceName, appName, version), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Handles requests to list all resources in an App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param version Array of Get5ItemsItem. + * @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 object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync( + String resourceGroupName, String serviceName, String appName, List version, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, serviceName, appName, version, context), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Handles requests to list all resources in an App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App 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 object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync(String resourceGroupName, String serviceName, String appName) { + final List version = null; + final Context context = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, serviceName, appName, version), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Handles requests to list all resources in an App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param version Array of Get5ItemsItem. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String serviceName, String appName, List version) { + return new PagedIterable<>(listAsync(resourceGroupName, serviceName, appName, version)); + } + + /** + * Handles requests to list all resources in an App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param version Array of Get5ItemsItem. + * @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 object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String serviceName, String appName, List version, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, serviceName, appName, version, context)); + } + + /** + * Handles requests to list all resources in an App. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App 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 object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serviceName, String appName) { + final List version = null; + final Context context = null; + return new PagedIterable<>(listAsync(resourceGroupName, serviceName, appName, version)); + } + + /** + * List deployments for a certain service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param version Array of Get4ItemsItem. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listClusterAllDeploymentsSinglePageAsync( + String resourceGroupName, String serviceName, List version) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + String versionConverted = + JacksonAdapter.createDefaultSerializerAdapter().serializeList(version, CollectionFormat.CSV); + return FluxUtil + .withContext( + context -> + service + .listClusterAllDeployments( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + versionConverted, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List deployments for a certain service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param version Array of Get4ItemsItem. + * @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 object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listClusterAllDeploymentsSinglePageAsync( + String resourceGroupName, String serviceName, List version, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + String versionConverted = + JacksonAdapter.createDefaultSerializerAdapter().serializeList(version, CollectionFormat.CSV); + return service + .listClusterAllDeployments( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + versionConverted, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List deployments for a certain service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param version Array of Get4ItemsItem. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listClusterAllDeploymentsAsync( + String resourceGroupName, String serviceName, List version) { + return new PagedFlux<>( + () -> listClusterAllDeploymentsSinglePageAsync(resourceGroupName, serviceName, version), + nextLink -> listClusterAllDeploymentsNextSinglePageAsync(nextLink)); + } + + /** + * List deployments for a certain service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param version Array of Get4ItemsItem. + * @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 object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listClusterAllDeploymentsAsync( + String resourceGroupName, String serviceName, List version, Context context) { + return new PagedFlux<>( + () -> listClusterAllDeploymentsSinglePageAsync(resourceGroupName, serviceName, version, context), + nextLink -> listClusterAllDeploymentsNextSinglePageAsync(nextLink)); + } + + /** + * List deployments for a certain service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listClusterAllDeploymentsAsync( + String resourceGroupName, String serviceName) { + final List version = null; + final Context context = null; + return new PagedFlux<>( + () -> listClusterAllDeploymentsSinglePageAsync(resourceGroupName, serviceName, version), + nextLink -> listClusterAllDeploymentsNextSinglePageAsync(nextLink)); + } + + /** + * List deployments for a certain service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param version Array of Get4ItemsItem. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listClusterAllDeployments( + String resourceGroupName, String serviceName, List version) { + return new PagedIterable<>(listClusterAllDeploymentsAsync(resourceGroupName, serviceName, version)); + } + + /** + * List deployments for a certain service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param version Array of Get4ItemsItem. + * @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 object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listClusterAllDeployments( + String resourceGroupName, String serviceName, List version, Context context) { + return new PagedIterable<>(listClusterAllDeploymentsAsync(resourceGroupName, serviceName, version, context)); + } + + /** + * List deployments for a certain service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listClusterAllDeployments( + String resourceGroupName, String serviceName) { + final List version = null; + final Context context = null; + return new PagedIterable<>(listClusterAllDeploymentsAsync(resourceGroupName, serviceName, version)); + } + + /** + * Start the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> startWithResponseAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .start( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + deploymentName, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Start the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> startWithResponseAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + return service + .start( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + deploymentName, + context); + } + + /** + * Start the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PollerFlux, Void> beginStartAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName) { + Mono>> mono = + startWithResponseAsync(resourceGroupName, serviceName, appName, deploymentName); + return this.client.getLroResultAsync(mono, this.client.getHttpPipeline(), Void.class, Void.class); + } + + /** + * Start the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PollerFlux, Void> beginStartAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName, Context context) { + Mono>> mono = + startWithResponseAsync(resourceGroupName, serviceName, appName, deploymentName, context); + return this.client.getLroResultAsync(mono, this.client.getHttpPipeline(), Void.class, Void.class); + } + + /** + * Start the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginStart( + String resourceGroupName, String serviceName, String appName, String deploymentName) { + return beginStartAsync(resourceGroupName, serviceName, appName, deploymentName).getSyncPoller(); + } + + /** + * Start the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginStart( + String resourceGroupName, String serviceName, String appName, String deploymentName, Context context) { + return beginStartAsync(resourceGroupName, serviceName, appName, deploymentName, context).getSyncPoller(); + } + + /** + * Start the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono startAsync(String resourceGroupName, String serviceName, String appName, String deploymentName) { + return beginStartAsync(resourceGroupName, serviceName, appName, deploymentName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Start the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono startAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName, Context context) { + return beginStartAsync(resourceGroupName, serviceName, appName, deploymentName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Start the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void start(String resourceGroupName, String serviceName, String appName, String deploymentName) { + startAsync(resourceGroupName, serviceName, appName, deploymentName).block(); + } + + /** + * Start the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void start( + String resourceGroupName, String serviceName, String appName, String deploymentName, Context context) { + startAsync(resourceGroupName, serviceName, appName, deploymentName, context).block(); + } + + /** + * Stop the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> stopWithResponseAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .stop( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + deploymentName, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Stop the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> stopWithResponseAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + return service + .stop( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + deploymentName, + context); + } + + /** + * Stop the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PollerFlux, Void> beginStopAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName) { + Mono>> mono = + stopWithResponseAsync(resourceGroupName, serviceName, appName, deploymentName); + return this.client.getLroResultAsync(mono, this.client.getHttpPipeline(), Void.class, Void.class); + } + + /** + * Stop the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PollerFlux, Void> beginStopAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName, Context context) { + Mono>> mono = + stopWithResponseAsync(resourceGroupName, serviceName, appName, deploymentName, context); + return this.client.getLroResultAsync(mono, this.client.getHttpPipeline(), Void.class, Void.class); + } + + /** + * Stop the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginStop( + String resourceGroupName, String serviceName, String appName, String deploymentName) { + return beginStopAsync(resourceGroupName, serviceName, appName, deploymentName).getSyncPoller(); + } + + /** + * Stop the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginStop( + String resourceGroupName, String serviceName, String appName, String deploymentName, Context context) { + return beginStopAsync(resourceGroupName, serviceName, appName, deploymentName, context).getSyncPoller(); + } + + /** + * Stop the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono stopAsync(String resourceGroupName, String serviceName, String appName, String deploymentName) { + return beginStopAsync(resourceGroupName, serviceName, appName, deploymentName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Stop the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono stopAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName, Context context) { + return beginStopAsync(resourceGroupName, serviceName, appName, deploymentName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Stop the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void stop(String resourceGroupName, String serviceName, String appName, String deploymentName) { + stopAsync(resourceGroupName, serviceName, appName, deploymentName).block(); + } + + /** + * Stop the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void stop( + String resourceGroupName, String serviceName, String appName, String deploymentName, Context context) { + stopAsync(resourceGroupName, serviceName, appName, deploymentName, context).block(); + } + + /** + * Restart the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> restartWithResponseAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .restart( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + deploymentName, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Restart the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> restartWithResponseAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + return service + .restart( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + deploymentName, + context); + } + + /** + * Restart the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PollerFlux, Void> beginRestartAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName) { + Mono>> mono = + restartWithResponseAsync(resourceGroupName, serviceName, appName, deploymentName); + return this.client.getLroResultAsync(mono, this.client.getHttpPipeline(), Void.class, Void.class); + } + + /** + * Restart the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PollerFlux, Void> beginRestartAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName, Context context) { + Mono>> mono = + restartWithResponseAsync(resourceGroupName, serviceName, appName, deploymentName, context); + return this.client.getLroResultAsync(mono, this.client.getHttpPipeline(), Void.class, Void.class); + } + + /** + * Restart the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginRestart( + String resourceGroupName, String serviceName, String appName, String deploymentName) { + return beginRestartAsync(resourceGroupName, serviceName, appName, deploymentName).getSyncPoller(); + } + + /** + * Restart the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginRestart( + String resourceGroupName, String serviceName, String appName, String deploymentName, Context context) { + return beginRestartAsync(resourceGroupName, serviceName, appName, deploymentName, context).getSyncPoller(); + } + + /** + * Restart the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono restartAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName) { + return beginRestartAsync(resourceGroupName, serviceName, appName, deploymentName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restart the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono restartAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName, Context context) { + return beginRestartAsync(resourceGroupName, serviceName, appName, deploymentName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restart the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void restart(String resourceGroupName, String serviceName, String appName, String deploymentName) { + restartAsync(resourceGroupName, serviceName, appName, deploymentName).block(); + } + + /** + * Restart the deployment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void restart( + String resourceGroupName, String serviceName, String appName, String deploymentName, Context context) { + restartAsync(resourceGroupName, serviceName, appName, deploymentName, context).block(); + } + + /** + * Get deployment log file URL. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 deployment log file URL. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getLogFileUrlWithResponseAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .getLogFileUrl( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + deploymentName, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get deployment log file URL. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 deployment log file URL. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getLogFileUrlWithResponseAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (appName == null) { + return Mono.error(new IllegalArgumentException("Parameter appName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + return service + .getLogFileUrl( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + appName, + deploymentName, + context); + } + + /** + * Get deployment log file URL. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 deployment log file URL. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getLogFileUrlAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName) { + return getLogFileUrlWithResponseAsync(resourceGroupName, serviceName, appName, deploymentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get deployment log file URL. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 deployment log file URL. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getLogFileUrlAsync( + String resourceGroupName, String serviceName, String appName, String deploymentName, Context context) { + return getLogFileUrlWithResponseAsync(resourceGroupName, serviceName, appName, deploymentName, context) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get deployment log file URL. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 deployment log file URL. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogFileUrlResponseInner getLogFileUrl( + String resourceGroupName, String serviceName, String appName, String deploymentName) { + return getLogFileUrlAsync(resourceGroupName, serviceName, appName, deploymentName).block(); + } + + /** + * Get deployment log file URL. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param appName The name of the App resource. + * @param deploymentName The name of the Deployment 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 deployment log file URL. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogFileUrlResponseInner getLogFileUrl( + String resourceGroupName, String serviceName, String appName, String deploymentName, Context context) { + return getLogFileUrlAsync(resourceGroupName, serviceName, appName, deploymentName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + return FluxUtil + .withContext(context -> service.listNext(nextLink, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + return service + .listNext(nextLink, 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 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 object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listClusterAllDeploymentsNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + return FluxUtil + .withContext(context -> service.listClusterAllDeploymentsNext(nextLink, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 object that includes an array of App resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listClusterAllDeploymentsNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + return service + .listClusterAllDeploymentsNext(nextLink, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/OperationsClient.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/OperationsClient.java new file mode 100644 index 000000000000..3b81c594d1df --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/OperationsClient.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.appplatform.fluent; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.appplatform.AppPlatformManagementClient; +import com.azure.resourcemanager.appplatform.fluent.inner.AvailableOperationsInner; +import com.azure.resourcemanager.appplatform.fluent.inner.OperationDetailInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in Operations. */ +public final class OperationsClient { + private final ClientLogger logger = new ClientLogger(OperationsClient.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final AppPlatformManagementClient client; + + /** + * Initializes an instance of OperationsClient. + * + * @param client the instance of the service client containing this operation class. + */ + public OperationsClient(AppPlatformManagementClient client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AppPlatformManagementClientOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AppPlatformManagemen") + private interface OperationsService { + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Get("/providers/Microsoft.AppPlatform/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, Context context); + } + + /** + * Lists all of the available REST API operations of the Microsoft.AppPlatform 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 available operations of the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists all of the available REST API operations of the Microsoft.AppPlatform 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 available operations of the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the available REST API operations of the Microsoft.AppPlatform 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 available operations of the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available REST API operations of the Microsoft.AppPlatform 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 available operations of the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available REST API operations of the Microsoft.AppPlatform 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 available operations of the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the available REST API operations of the Microsoft.AppPlatform 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 available operations of the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 available operations of the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + return FluxUtil + .withContext(context -> service.listNext(nextLink, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 available operations of the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + return service + .listNext(nextLink, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/ServicesClient.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/ServicesClient.java new file mode 100644 index 000000000000..9f9648f56e3f --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/ServicesClient.java @@ -0,0 +1,2432 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.appplatform.fluent; + +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.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.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.appplatform.AppPlatformManagementClient; +import com.azure.resourcemanager.appplatform.fluent.inner.NameAvailabilityInner; +import com.azure.resourcemanager.appplatform.fluent.inner.ServiceResourceInner; +import com.azure.resourcemanager.appplatform.fluent.inner.ServiceResourceListInner; +import com.azure.resourcemanager.appplatform.models.NameAvailabilityParameters; +import com.azure.resourcemanager.appplatform.models.RegenerateTestKeyRequestPayload; +import com.azure.resourcemanager.appplatform.models.TestKeyType; +import com.azure.resourcemanager.appplatform.models.TestKeys; +import com.azure.resourcemanager.resources.fluentcore.collection.InnerSupportsDelete; +import com.azure.resourcemanager.resources.fluentcore.collection.InnerSupportsGet; +import com.azure.resourcemanager.resources.fluentcore.collection.InnerSupportsListing; +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 Services. */ +public final class ServicesClient + implements InnerSupportsGet, + InnerSupportsListing, + InnerSupportsDelete { + private final ClientLogger logger = new ClientLogger(ServicesClient.class); + + /** The proxy service used to perform REST calls. */ + private final ServicesService service; + + /** The service client containing this operation class. */ + private final AppPlatformManagementClient client; + + /** + * Initializes an instance of ServicesClient. + * + * @param client the instance of the service client containing this operation class. + */ + public ServicesClient(AppPlatformManagementClient client) { + this.service = RestProxy.create(ServicesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AppPlatformManagementClientServices to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AppPlatformManagemen") + private interface ServicesService { + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}") + @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("serviceName") String serviceName, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}") + @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("serviceName") String serviceName, + @BodyParam("application/json") ServiceResourceInner resource, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}") + @ExpectedResponses({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("serviceName") String serviceName, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @BodyParam("application/json") ServiceResourceInner resource, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/listTestKeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listTestKeys( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/regenerateTestKey") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> regenerateTestKey( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @BodyParam("application/json") RegenerateTestKeyRequestPayload regenerateTestKeyRequest, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/disableTestEndpoint") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> disableTestEndpoint( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + + "/{serviceName}/enableTestEndpoint") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> enableTestEndpoint( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}" + + "/checkNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameAvailability( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @BodyParam("application/json") NameAvailabilityParameters availabilityParameters, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, Context context); + } + + /** + * Get a Service 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 serviceName The name of the Service 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 a Service and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String serviceName) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get a Service 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 serviceName The name of the Service 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 a Service and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String serviceName, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + context); + } + + /** + * Get a Service 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 serviceName The name of the Service 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 a Service and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getByResourceGroupAsync(String resourceGroupName, String serviceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, serviceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a Service 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 serviceName The name of the Service 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 a Service and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getByResourceGroupAsync( + String resourceGroupName, String serviceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, serviceName, context) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a Service 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 serviceName The name of the Service 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 a Service and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceResourceInner getByResourceGroup(String resourceGroupName, String serviceName) { + return getByResourceGroupAsync(resourceGroupName, serviceName).block(); + } + + /** + * Get a Service 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 serviceName The name of the Service 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 a Service and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceResourceInner getByResourceGroup(String resourceGroupName, String serviceName, Context context) { + return getByResourceGroupAsync(resourceGroupName, serviceName, context).block(); + } + + /** + * Create a new Service or update an exiting Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param resource Service 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 service resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serviceName, ServiceResourceInner 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName 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(); + } + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + resource, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create a new Service or update an exiting Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param resource Service 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 service resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serviceName, ServiceResourceInner 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName 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(); + } + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + resource, + context); + } + + /** + * Create a new Service or update an exiting Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param resource Service 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 service resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PollerFlux, ServiceResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serviceName, ServiceResourceInner resource) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serviceName, resource); + return this + .client + .getLroResultAsync( + mono, this.client.getHttpPipeline(), ServiceResourceInner.class, ServiceResourceInner.class); + } + + /** + * Create a new Service or update an exiting Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param resource Service 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 service resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PollerFlux, ServiceResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serviceName, ServiceResourceInner resource, Context context) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serviceName, resource, context); + return this + .client + .getLroResultAsync( + mono, this.client.getHttpPipeline(), ServiceResourceInner.class, ServiceResourceInner.class); + } + + /** + * Create a new Service or update an exiting Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param resource Service 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 service resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServiceResourceInner> beginCreateOrUpdate( + String resourceGroupName, String serviceName, ServiceResourceInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, serviceName, resource).getSyncPoller(); + } + + /** + * Create a new Service or update an exiting Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param resource Service 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 service resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServiceResourceInner> beginCreateOrUpdate( + String resourceGroupName, String serviceName, ServiceResourceInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serviceName, resource, context).getSyncPoller(); + } + + /** + * Create a new Service or update an exiting Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param resource Service 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 service resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync( + String resourceGroupName, String serviceName, ServiceResourceInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, serviceName, resource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a new Service or update an exiting Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param resource Service 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 service resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync( + String resourceGroupName, String serviceName, ServiceResourceInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serviceName, resource, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a new Service or update an exiting Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param resource Service 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 service resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceResourceInner createOrUpdate( + String resourceGroupName, String serviceName, ServiceResourceInner resource) { + return createOrUpdateAsync(resourceGroupName, serviceName, resource).block(); + } + + /** + * Create a new Service or update an exiting Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param resource Service 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 service resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceResourceInner createOrUpdate( + String resourceGroupName, String serviceName, ServiceResourceInner resource, Context context) { + return createOrUpdateAsync(resourceGroupName, serviceName, resource, context).block(); + } + + /** + * Operation to delete a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> deleteWithResponseAsync(String resourceGroupName, String serviceName) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Operation to delete a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> deleteWithResponseAsync( + String resourceGroupName, String serviceName, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + context); + } + + /** + * Operation to delete a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String serviceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serviceName); + return this.client.getLroResultAsync(mono, this.client.getHttpPipeline(), Void.class, Void.class); + } + + /** + * Operation to delete a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serviceName, Context context) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serviceName, context); + return this.client.getLroResultAsync(mono, this.client.getHttpPipeline(), Void.class, Void.class); + } + + /** + * Operation to delete a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String serviceName) { + return beginDeleteAsync(resourceGroupName, serviceName).getSyncPoller(); + } + + /** + * Operation to delete a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serviceName, Context context) { + return beginDeleteAsync(resourceGroupName, serviceName, context).getSyncPoller(); + } + + /** + * Operation to delete a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAsync(String resourceGroupName, String serviceName) { + return beginDeleteAsync(resourceGroupName, serviceName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Operation to delete a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAsync(String resourceGroupName, String serviceName, Context context) { + return beginDeleteAsync(resourceGroupName, serviceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Operation to delete a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serviceName) { + deleteAsync(resourceGroupName, serviceName).block(); + } + + /** + * Operation to delete a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serviceName, Context context) { + deleteAsync(resourceGroupName, serviceName, context).block(); + } + + /** + * Operation to update an exiting Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param resource Service 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 service resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> updateWithResponseAsync( + String resourceGroupName, String serviceName, ServiceResourceInner 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName 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(); + } + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + resource, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Operation to update an exiting Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param resource Service 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 service resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> updateWithResponseAsync( + String resourceGroupName, String serviceName, ServiceResourceInner 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName 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(); + } + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + resource, + context); + } + + /** + * Operation to update an exiting Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param resource Service 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 service resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PollerFlux, ServiceResourceInner> beginUpdateAsync( + String resourceGroupName, String serviceName, ServiceResourceInner resource) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, serviceName, resource); + return this + .client + .getLroResultAsync( + mono, this.client.getHttpPipeline(), ServiceResourceInner.class, ServiceResourceInner.class); + } + + /** + * Operation to update an exiting Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param resource Service 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 service resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PollerFlux, ServiceResourceInner> beginUpdateAsync( + String resourceGroupName, String serviceName, ServiceResourceInner resource, Context context) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serviceName, resource, context); + return this + .client + .getLroResultAsync( + mono, this.client.getHttpPipeline(), ServiceResourceInner.class, ServiceResourceInner.class); + } + + /** + * Operation to update an exiting Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param resource Service 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 service resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServiceResourceInner> beginUpdate( + String resourceGroupName, String serviceName, ServiceResourceInner resource) { + return beginUpdateAsync(resourceGroupName, serviceName, resource).getSyncPoller(); + } + + /** + * Operation to update an exiting Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param resource Service 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 service resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServiceResourceInner> beginUpdate( + String resourceGroupName, String serviceName, ServiceResourceInner resource, Context context) { + return beginUpdateAsync(resourceGroupName, serviceName, resource, context).getSyncPoller(); + } + + /** + * Operation to update an exiting Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param resource Service 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 service resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateAsync( + String resourceGroupName, String serviceName, ServiceResourceInner resource) { + return beginUpdateAsync(resourceGroupName, serviceName, resource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Operation to update an exiting Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param resource Service 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 service resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateAsync( + String resourceGroupName, String serviceName, ServiceResourceInner resource, Context context) { + return beginUpdateAsync(resourceGroupName, serviceName, resource, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Operation to update an exiting Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param resource Service 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 service resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceResourceInner update(String resourceGroupName, String serviceName, ServiceResourceInner resource) { + return updateAsync(resourceGroupName, serviceName, resource).block(); + } + + /** + * Operation to update an exiting Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param resource Service 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 service resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceResourceInner update( + String resourceGroupName, String serviceName, ServiceResourceInner resource, Context context) { + return updateAsync(resourceGroupName, serviceName, resource, context).block(); + } + + /** + * List test keys for a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 test keys payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listTestKeysWithResponseAsync(String resourceGroupName, String serviceName) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .listTestKeys( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List test keys for a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 test keys payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listTestKeysWithResponseAsync( + String resourceGroupName, String serviceName, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + return service + .listTestKeys( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + context); + } + + /** + * List test keys for a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 test keys payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listTestKeysAsync(String resourceGroupName, String serviceName) { + return listTestKeysWithResponseAsync(resourceGroupName, serviceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * List test keys for a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 test keys payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listTestKeysAsync(String resourceGroupName, String serviceName, Context context) { + return listTestKeysWithResponseAsync(resourceGroupName, serviceName, context) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * List test keys for a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 test keys payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestKeys listTestKeys(String resourceGroupName, String serviceName) { + return listTestKeysAsync(resourceGroupName, serviceName).block(); + } + + /** + * List test keys for a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 test keys payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestKeys listTestKeys(String resourceGroupName, String serviceName, Context context) { + return listTestKeysAsync(resourceGroupName, serviceName, context).block(); + } + + /** + * Regenerate a test key for a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param keyType Type of the test key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test keys payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> regenerateTestKeyWithResponseAsync( + String resourceGroupName, String serviceName, TestKeyType keyType) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (keyType == null) { + return Mono.error(new IllegalArgumentException("Parameter keyType is required and cannot be null.")); + } + RegenerateTestKeyRequestPayload regenerateTestKeyRequest = new RegenerateTestKeyRequestPayload(); + regenerateTestKeyRequest.withKeyType(keyType); + return FluxUtil + .withContext( + context -> + service + .regenerateTestKey( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + regenerateTestKeyRequest, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Regenerate a test key for a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param keyType Type of the test key. + * @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 test keys payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> regenerateTestKeyWithResponseAsync( + String resourceGroupName, String serviceName, TestKeyType keyType, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (keyType == null) { + return Mono.error(new IllegalArgumentException("Parameter keyType is required and cannot be null.")); + } + RegenerateTestKeyRequestPayload regenerateTestKeyRequest = new RegenerateTestKeyRequestPayload(); + regenerateTestKeyRequest.withKeyType(keyType); + return service + .regenerateTestKey( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + regenerateTestKeyRequest, + context); + } + + /** + * Regenerate a test key for a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param keyType Type of the test key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test keys payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono regenerateTestKeyAsync(String resourceGroupName, String serviceName, TestKeyType keyType) { + return regenerateTestKeyWithResponseAsync(resourceGroupName, serviceName, keyType) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Regenerate a test key for a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param keyType Type of the test key. + * @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 test keys payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono regenerateTestKeyAsync( + String resourceGroupName, String serviceName, TestKeyType keyType, Context context) { + return regenerateTestKeyWithResponseAsync(resourceGroupName, serviceName, keyType, context) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Regenerate a test key for a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param keyType Type of the test key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test keys payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestKeys regenerateTestKey(String resourceGroupName, String serviceName, TestKeyType keyType) { + return regenerateTestKeyAsync(resourceGroupName, serviceName, keyType).block(); + } + + /** + * Regenerate a test key for a Service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service resource. + * @param keyType Type of the test key. + * @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 test keys payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestKeys regenerateTestKey( + String resourceGroupName, String serviceName, TestKeyType keyType, Context context) { + return regenerateTestKeyAsync(resourceGroupName, serviceName, keyType, context).block(); + } + + /** + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> disableTestEndpointWithResponseAsync(String resourceGroupName, String serviceName) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .disableTestEndpoint( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> disableTestEndpointWithResponseAsync( + String resourceGroupName, String serviceName, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + return service + .disableTestEndpoint( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + context); + } + + /** + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono disableTestEndpointAsync(String resourceGroupName, String serviceName) { + return disableTestEndpointWithResponseAsync(resourceGroupName, serviceName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono disableTestEndpointAsync(String resourceGroupName, String serviceName, Context context) { + return disableTestEndpointWithResponseAsync(resourceGroupName, serviceName, context) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void disableTestEndpoint(String resourceGroupName, String serviceName) { + disableTestEndpointAsync(resourceGroupName, serviceName).block(); + } + + /** + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void disableTestEndpoint(String resourceGroupName, String serviceName, Context context) { + disableTestEndpointAsync(resourceGroupName, serviceName, context).block(); + } + + /** + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 test keys payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> enableTestEndpointWithResponseAsync(String resourceGroupName, String serviceName) { + 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .enableTestEndpoint( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 test keys payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> enableTestEndpointWithResponseAsync( + String resourceGroupName, String serviceName, 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + return service + .enableTestEndpoint( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + context); + } + + /** + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 test keys payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono enableTestEndpointAsync(String resourceGroupName, String serviceName) { + return enableTestEndpointWithResponseAsync(resourceGroupName, serviceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 test keys payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono enableTestEndpointAsync(String resourceGroupName, String serviceName, Context context) { + return enableTestEndpointWithResponseAsync(resourceGroupName, serviceName, context) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 test keys payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestKeys enableTestEndpoint(String resourceGroupName, String serviceName) { + return enableTestEndpointAsync(resourceGroupName, serviceName).block(); + } + + /** + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serviceName The name of the Service 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 test keys payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestKeys enableTestEndpoint(String resourceGroupName, String serviceName, Context context) { + return enableTestEndpointAsync(resourceGroupName, serviceName, context).block(); + } + + /** + * Checks that the resource name is valid and is not already in use. + * + * @param location the region. + * @param availabilityParameters Name availability parameters payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return name availability result payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> checkNameAvailabilityWithResponseAsync( + String location, NameAvailabilityParameters availabilityParameters) { + 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 (availabilityParameters == null) { + return Mono + .error( + new IllegalArgumentException("Parameter availabilityParameters is required and cannot be null.")); + } else { + availabilityParameters.validate(); + } + return FluxUtil + .withContext( + context -> + service + .checkNameAvailability( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + availabilityParameters, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Checks that the resource name is valid and is not already in use. + * + * @param location the region. + * @param availabilityParameters Name availability parameters payload. + * @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 name availability result payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> checkNameAvailabilityWithResponseAsync( + String location, NameAvailabilityParameters availabilityParameters, 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 (availabilityParameters == null) { + return Mono + .error( + new IllegalArgumentException("Parameter availabilityParameters is required and cannot be null.")); + } else { + availabilityParameters.validate(); + } + return service + .checkNameAvailability( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + availabilityParameters, + context); + } + + /** + * Checks that the resource name is valid and is not already in use. + * + * @param location the region. + * @param availabilityParameters Name availability parameters payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return name availability result payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono checkNameAvailabilityAsync( + String location, NameAvailabilityParameters availabilityParameters) { + return checkNameAvailabilityWithResponseAsync(location, availabilityParameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Checks that the resource name is valid and is not already in use. + * + * @param location the region. + * @param availabilityParameters Name availability parameters payload. + * @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 name availability result payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono checkNameAvailabilityAsync( + String location, NameAvailabilityParameters availabilityParameters, Context context) { + return checkNameAvailabilityWithResponseAsync(location, availabilityParameters, context) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Checks that the resource name is valid and is not already in use. + * + * @param location the region. + * @param availabilityParameters Name availability parameters payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return name availability result payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NameAvailabilityInner checkNameAvailability( + String location, NameAvailabilityParameters availabilityParameters) { + return checkNameAvailabilityAsync(location, availabilityParameters).block(); + } + + /** + * Checks that the resource name is valid and is not already in use. + * + * @param location the region. + * @param availabilityParameters Name availability parameters payload. + * @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 name availability result payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NameAvailabilityInner checkNameAvailability( + String location, NameAvailabilityParameters availabilityParameters, Context context) { + return checkNameAvailabilityAsync(location, availabilityParameters, context).block(); + } + + /** + * Handles requests to list all resources in a 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 object that includes an array of Service resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public 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.")); + } + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Handles requests to list all resources in a 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 object that includes an array of Service resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public 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.")); + } + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Handles requests to list all resources in a 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 object that includes an array of Service resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Handles requests to list all resources in a 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 object that includes an array of Service resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Handles requests to list all resources in a 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 object that includes an array of Service resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Handles requests to list all resources in a 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 object that includes an array of Service resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of Service resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public 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.")); + } + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 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 object that includes an array of Service resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public 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.")); + } + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of Service resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * 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 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 object that includes an array of Service resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of Service resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * 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 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 object that includes an array of Service resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 object that includes an array of Service resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + return FluxUtil + .withContext(context -> service.listBySubscriptionNext(nextLink, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 object that includes an array of Service resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + return service + .listBySubscriptionNext(nextLink, 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 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 object that includes an array of Service resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + return FluxUtil + .withContext(context -> service.listNext(nextLink, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 object that includes an array of Service resources and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + return service + .listNext(nextLink, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/SkusClient.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/SkusClient.java new file mode 100644 index 000000000000..30ebdec908c9 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/SkusClient.java @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.appplatform.fluent; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.appplatform.AppPlatformManagementClient; +import com.azure.resourcemanager.appplatform.fluent.inner.ResourceSkuCollectionInner; +import com.azure.resourcemanager.appplatform.models.ResourceSku; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in Skus. */ +public final class SkusClient { + private final ClientLogger logger = new ClientLogger(SkusClient.class); + + /** The proxy service used to perform REST calls. */ + private final SkusService service; + + /** The service client containing this operation class. */ + private final AppPlatformManagementClient client; + + /** + * Initializes an instance of SkusClient. + * + * @param client the instance of the service client containing this operation class. + */ + public SkusClient(AppPlatformManagementClient client) { + this.service = RestProxy.create(SkusService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AppPlatformManagementClientSkus to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AppPlatformManagemen") + private interface SkusService { + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + Context context); + + @Headers({"Accept: application/json", "Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, 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 the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public 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.")); + } + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * @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 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.")); + } + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * @throws ManagementException 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.COLLECTION) + public PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * @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.COLLECTION) + public PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * @throws ManagementException 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.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * @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.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + return FluxUtil + .withContext(context -> service.listNext(nextLink, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + return service + .listNext(nextLink, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/AppResourceCollectionInner.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/AppResourceCollectionInner.java new file mode 100644 index 000000000000..2f109d497941 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/AppResourceCollectionInner.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.appplatform.fluent.inner; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The AppResourceCollection model. */ +@Fluent +public final class AppResourceCollectionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AppResourceCollectionInner.class); + + /* + * Collection of App resources + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL 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; + + /** + * Get the value property: Collection of App resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Collection of App resources. + * + * @param value the value value to set. + * @return the AppResourceCollectionInner object itself. + */ + public AppResourceCollectionInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL 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: URL 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 AppResourceCollectionInner object itself. + */ + public AppResourceCollectionInner 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/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/AppResourceInner.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/AppResourceInner.java new file mode 100644 index 000000000000..f58db5c69ff1 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/AppResourceInner.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.appplatform.fluent.inner; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.appplatform.models.AppResourceProperties; +import com.azure.resourcemanager.appplatform.models.ManagedIdentityProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The AppResource model. */ +@Fluent +public final class AppResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AppResourceInner.class); + + /* + * Properties of the App resource + */ + @JsonProperty(value = "properties") + private AppResourceProperties properties; + + /* + * The Managed Identity type of the app resource + */ + @JsonProperty(value = "identity") + private ManagedIdentityProperties identity; + + /* + * The GEO location of the application, always the same with its parent + * resource + */ + @JsonProperty(value = "location") + private String location; + + /** + * Get the properties property: Properties of the App resource. + * + * @return the properties value. + */ + public AppResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the App resource. + * + * @param properties the properties value to set. + * @return the AppResourceInner object itself. + */ + public AppResourceInner withProperties(AppResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the identity property: The Managed Identity type of the app resource. + * + * @return the identity value. + */ + public ManagedIdentityProperties identity() { + return this.identity; + } + + /** + * Set the identity property: The Managed Identity type of the app resource. + * + * @param identity the identity value to set. + * @return the AppResourceInner object itself. + */ + public AppResourceInner withIdentity(ManagedIdentityProperties identity) { + this.identity = identity; + return this; + } + + /** + * Get the location property: The GEO location of the application, always the same with its parent resource. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The GEO location of the application, always the same with its parent resource. + * + * @param location the location value to set. + * @return the AppResourceInner object itself. + */ + public AppResourceInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/AvailableOperationsInner.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/AvailableOperationsInner.java new file mode 100644 index 000000000000..67d4a6bb318a --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/AvailableOperationsInner.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.appplatform.fluent.inner; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The AvailableOperations model. */ +@Fluent +public final class AvailableOperationsInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AvailableOperationsInner.class); + + /* + * Collection of available operation details + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL 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; + + /** + * Get the value property: Collection of available operation details. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Collection of available operation details. + * + * @param value the value value to set. + * @return the AvailableOperationsInner object itself. + */ + public AvailableOperationsInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL 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: URL 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 AvailableOperationsInner object itself. + */ + public AvailableOperationsInner 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/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/BindingResourceCollectionInner.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/BindingResourceCollectionInner.java new file mode 100644 index 000000000000..0df492b8aec3 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/BindingResourceCollectionInner.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.appplatform.fluent.inner; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The BindingResourceCollection model. */ +@Fluent +public final class BindingResourceCollectionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BindingResourceCollectionInner.class); + + /* + * Collection of Binding resources + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL 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; + + /** + * Get the value property: Collection of Binding resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Collection of Binding resources. + * + * @param value the value value to set. + * @return the BindingResourceCollectionInner object itself. + */ + public BindingResourceCollectionInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL 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: URL 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 BindingResourceCollectionInner object itself. + */ + public BindingResourceCollectionInner 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/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/BindingResourceInner.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/BindingResourceInner.java new file mode 100644 index 000000000000..8cb4e051a6ad --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/BindingResourceInner.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.appplatform.fluent.inner; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.appplatform.models.BindingResourceProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The BindingResource model. */ +@Fluent +public final class BindingResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BindingResourceInner.class); + + /* + * Properties of the Binding resource + */ + @JsonProperty(value = "properties") + private BindingResourceProperties properties; + + /** + * Get the properties property: Properties of the Binding resource. + * + * @return the properties value. + */ + public BindingResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the Binding resource. + * + * @param properties the properties value to set. + * @return the BindingResourceInner object itself. + */ + public BindingResourceInner withProperties(BindingResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/CertificateResourceCollectionInner.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/CertificateResourceCollectionInner.java new file mode 100644 index 000000000000..364e824fb2a9 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/CertificateResourceCollectionInner.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.appplatform.fluent.inner; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The CertificateResourceCollection model. */ +@Fluent +public final class CertificateResourceCollectionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificateResourceCollectionInner.class); + + /* + * The certificate resources list. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link to next page of certificate list. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The certificate resources list. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The certificate resources list. + * + * @param value the value value to set. + * @return the CertificateResourceCollectionInner object itself. + */ + public CertificateResourceCollectionInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to next page of certificate list. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to next page of certificate list. + * + * @param nextLink the nextLink value to set. + * @return the CertificateResourceCollectionInner object itself. + */ + public CertificateResourceCollectionInner 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/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/CertificateResourceInner.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/CertificateResourceInner.java new file mode 100644 index 000000000000..d07a5ba613bf --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/CertificateResourceInner.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.appplatform.fluent.inner; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.appplatform.models.CertificateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CertificateResource model. */ +@Fluent +public final class CertificateResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificateResourceInner.class); + + /* + * Properties of the certificate resource payload. + */ + @JsonProperty(value = "properties") + private CertificateProperties properties; + + /** + * Get the properties property: Properties of the certificate resource payload. + * + * @return the properties value. + */ + public CertificateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the certificate resource payload. + * + * @param properties the properties value to set. + * @return the CertificateResourceInner object itself. + */ + public CertificateResourceInner withProperties(CertificateProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/CustomDomainResourceCollectionInner.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/CustomDomainResourceCollectionInner.java new file mode 100644 index 000000000000..82118f638cec --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/CustomDomainResourceCollectionInner.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.appplatform.fluent.inner; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The CustomDomainResourceCollection model. */ +@Fluent +public final class CustomDomainResourceCollectionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomDomainResourceCollectionInner.class); + + /* + * The custom domain resources list. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link to next page of custom domain list. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The custom domain resources list. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The custom domain resources list. + * + * @param value the value value to set. + * @return the CustomDomainResourceCollectionInner object itself. + */ + public CustomDomainResourceCollectionInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to next page of custom domain list. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to next page of custom domain list. + * + * @param nextLink the nextLink value to set. + * @return the CustomDomainResourceCollectionInner object itself. + */ + public CustomDomainResourceCollectionInner 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/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/CustomDomainResourceInner.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/CustomDomainResourceInner.java new file mode 100644 index 000000000000..8e8ccf3aeabe --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/CustomDomainResourceInner.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.appplatform.fluent.inner; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.appplatform.models.CustomDomainProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CustomDomainResource model. */ +@Fluent +public final class CustomDomainResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomDomainResourceInner.class); + + /* + * Properties of the custom domain resource. + */ + @JsonProperty(value = "properties") + private CustomDomainProperties properties; + + /** + * Get the properties property: Properties of the custom domain resource. + * + * @return the properties value. + */ + public CustomDomainProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the custom domain resource. + * + * @param properties the properties value to set. + * @return the CustomDomainResourceInner object itself. + */ + public CustomDomainResourceInner withProperties(CustomDomainProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/CustomDomainValidateResultInner.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/CustomDomainValidateResultInner.java new file mode 100644 index 000000000000..321c7b235452 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/CustomDomainValidateResultInner.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.appplatform.fluent.inner; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CustomDomainValidateResult model. */ +@Fluent +public final class CustomDomainValidateResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomDomainValidateResultInner.class); + + /* + * Indicates if domain name is valid. + */ + @JsonProperty(value = "isValid") + private Boolean isValid; + + /* + * Message of why domain name is invalid. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the isValid property: Indicates if domain name is valid. + * + * @return the isValid value. + */ + public Boolean isValid() { + return this.isValid; + } + + /** + * Set the isValid property: Indicates if domain name is valid. + * + * @param isValid the isValid value to set. + * @return the CustomDomainValidateResultInner object itself. + */ + public CustomDomainValidateResultInner withIsValid(Boolean isValid) { + this.isValid = isValid; + return this; + } + + /** + * Get the message property: Message of why domain name is invalid. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Message of why domain name is invalid. + * + * @param message the message value to set. + * @return the CustomDomainValidateResultInner object itself. + */ + public CustomDomainValidateResultInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/DeploymentResourceCollectionInner.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/DeploymentResourceCollectionInner.java new file mode 100644 index 000000000000..93b4a772bbcb --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/DeploymentResourceCollectionInner.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.appplatform.fluent.inner; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The DeploymentResourceCollection model. */ +@Fluent +public final class DeploymentResourceCollectionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeploymentResourceCollectionInner.class); + + /* + * Collection of Deployment resources + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL 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; + + /** + * Get the value property: Collection of Deployment resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Collection of Deployment resources. + * + * @param value the value value to set. + * @return the DeploymentResourceCollectionInner object itself. + */ + public DeploymentResourceCollectionInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL 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: URL 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 DeploymentResourceCollectionInner object itself. + */ + public DeploymentResourceCollectionInner 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/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/DeploymentResourceInner.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/DeploymentResourceInner.java new file mode 100644 index 000000000000..8efd733bbbe2 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/DeploymentResourceInner.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.appplatform.fluent.inner; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.appplatform.models.DeploymentResourceProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The DeploymentResource model. */ +@Fluent +public final class DeploymentResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeploymentResourceInner.class); + + /* + * Properties of the Deployment resource + */ + @JsonProperty(value = "properties") + private DeploymentResourceProperties properties; + + /** + * Get the properties property: Properties of the Deployment resource. + * + * @return the properties value. + */ + public DeploymentResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the Deployment resource. + * + * @param properties the properties value to set. + * @return the DeploymentResourceInner object itself. + */ + public DeploymentResourceInner withProperties(DeploymentResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/LogFileUrlResponseInner.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/LogFileUrlResponseInner.java new file mode 100644 index 000000000000..f23bf3682238 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/LogFileUrlResponseInner.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.appplatform.fluent.inner; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The LogFileUrlResponse model. */ +@Fluent +public final class LogFileUrlResponseInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogFileUrlResponseInner.class); + + /* + * URL of the log file + */ + @JsonProperty(value = "url", required = true) + private String url; + + /** + * Get the url property: URL of the log file. + * + * @return the url value. + */ + public String url() { + return this.url; + } + + /** + * Set the url property: URL of the log file. + * + * @param url the url value to set. + * @return the LogFileUrlResponseInner object itself. + */ + public LogFileUrlResponseInner withUrl(String url) { + this.url = url; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (url() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property url in model LogFileUrlResponseInner")); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/NameAvailabilityInner.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/NameAvailabilityInner.java new file mode 100644 index 000000000000..72d4dd61764f --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/NameAvailabilityInner.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.appplatform.fluent.inner; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The NameAvailability model. */ +@Fluent +public final class NameAvailabilityInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NameAvailabilityInner.class); + + /* + * Indicates whether the name is available + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /* + * Reason why the name is not available + */ + @JsonProperty(value = "reason") + private String reason; + + /* + * Message why the name is not available + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the nameAvailable property: Indicates whether the name is available. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set the nameAvailable property: Indicates whether the name is available. + * + * @param nameAvailable the nameAvailable value to set. + * @return the NameAvailabilityInner object itself. + */ + public NameAvailabilityInner withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the reason property: Reason why the name is not available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: Reason why the name is not available. + * + * @param reason the reason value to set. + * @return the NameAvailabilityInner object itself. + */ + public NameAvailabilityInner withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Get the message property: Message why the name is not available. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Message why the name is not available. + * + * @param message the message value to set. + * @return the NameAvailabilityInner object itself. + */ + public NameAvailabilityInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/OperationDetailInner.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/OperationDetailInner.java new file mode 100644 index 000000000000..24de8b15d88b --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/OperationDetailInner.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.appplatform.fluent.inner; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.appplatform.models.OperationDisplay; +import com.azure.resourcemanager.appplatform.models.OperationProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The OperationDetail model. */ +@Fluent +public final class OperationDetailInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDetailInner.class); + + /* + * Name of the operation + */ + @JsonProperty(value = "name") + private String name; + + /* + * Indicates whether the operation is a data action + */ + @JsonProperty(value = "isDataAction") + private Boolean isDataAction; + + /* + * Display of the operation + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /* + * Origin of the operation + */ + @JsonProperty(value = "origin") + private String origin; + + /* + * Properties of the operation + */ + @JsonProperty(value = "properties") + private OperationProperties properties; + + /** + * Get the name property: Name of the operation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the operation. + * + * @param name the name value to set. + * @return the OperationDetailInner object itself. + */ + public OperationDetailInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the isDataAction property: Indicates whether the operation is a data action. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Set the isDataAction property: Indicates whether the operation is a data action. + * + * @param isDataAction the isDataAction value to set. + * @return the OperationDetailInner object itself. + */ + public OperationDetailInner withIsDataAction(Boolean isDataAction) { + this.isDataAction = isDataAction; + return this; + } + + /** + * Get the display property: Display of the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Display of the operation. + * + * @param display the display value to set. + * @return the OperationDetailInner object itself. + */ + public OperationDetailInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: Origin of the operation. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Set the origin property: Origin of the operation. + * + * @param origin the origin value to set. + * @return the OperationDetailInner object itself. + */ + public OperationDetailInner withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Get the properties property: Properties of the operation. + * + * @return the properties value. + */ + public OperationProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the operation. + * + * @param properties the properties value to set. + * @return the OperationDetailInner object itself. + */ + public OperationDetailInner withProperties(OperationProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/ResourceSkuCollectionInner.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/ResourceSkuCollectionInner.java new file mode 100644 index 000000000000..8cb0c08e98ab --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/ResourceSkuCollectionInner.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.appplatform.fluent.inner; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.appplatform.models.ResourceSku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The ResourceSkuCollection model. */ +@Fluent +public final class ResourceSkuCollectionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSkuCollectionInner.class); + + /* + * Collection of resource SKU + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL 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; + + /** + * Get the value property: Collection of resource SKU. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Collection of resource SKU. + * + * @param value the value value to set. + * @return the ResourceSkuCollectionInner object itself. + */ + public ResourceSkuCollectionInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL 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: URL 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 ResourceSkuCollectionInner object itself. + */ + public ResourceSkuCollectionInner 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/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/ServiceResourceInner.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/ServiceResourceInner.java new file mode 100644 index 000000000000..180198979b3d --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/ServiceResourceInner.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.appplatform.fluent.inner; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.appplatform.models.ClusterResourceProperties; +import com.azure.resourcemanager.appplatform.models.Sku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ServiceResource model. */ +@Fluent +public final class ServiceResourceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceResourceInner.class); + + /* + * Properties of the Service resource + */ + @JsonProperty(value = "properties") + private ClusterResourceProperties properties; + + /* + * Sku of the Service resource + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Get the properties property: Properties of the Service resource. + * + * @return the properties value. + */ + public ClusterResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the Service resource. + * + * @param properties the properties value to set. + * @return the ServiceResourceInner object itself. + */ + public ServiceResourceInner withProperties(ClusterResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the sku property: Sku of the Service resource. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: Sku of the Service resource. + * + * @param sku the sku value to set. + * @return the ServiceResourceInner object itself. + */ + public ServiceResourceInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (sku() != null) { + sku().validate(); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/ServiceResourceListInner.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/ServiceResourceListInner.java new file mode 100644 index 000000000000..6019ea83a38c --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/ServiceResourceListInner.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.appplatform.fluent.inner; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The ServiceResourceList model. */ +@Fluent +public final class ServiceResourceListInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceResourceListInner.class); + + /* + * Collection of Service resources + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL 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; + + /** + * Get the value property: Collection of Service resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Collection of Service resources. + * + * @param value the value value to set. + * @return the ServiceResourceListInner object itself. + */ + public ServiceResourceListInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL 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: URL 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 ServiceResourceListInner object itself. + */ + public ServiceResourceListInner 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/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/package-info.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/package-info.java new file mode 100644 index 000000000000..24d311207401 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/inner/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 inner classes for AppPlatformManagementClient. REST API for Azure Spring Cloud. */ +package com.azure.resourcemanager.appplatform.fluent.inner; diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/package-info.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/package-info.java new file mode 100644 index 000000000000..919204581a25 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/fluent/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 client classes for AppPlatformManagementClient. REST API for Azure Spring Cloud. */ +package com.azure.resourcemanager.appplatform.fluent; diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/implementation/SpringAppDeploymentImpl.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/implementation/SpringAppDeploymentImpl.java new file mode 100644 index 000000000000..d985f51f1d5c --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/implementation/SpringAppDeploymentImpl.java @@ -0,0 +1,412 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.appplatform.implementation; + +import com.azure.resourcemanager.appplatform.AppPlatformManager; +import com.azure.resourcemanager.appplatform.fluent.inner.DeploymentResourceInner; +import com.azure.resourcemanager.appplatform.fluent.inner.LogFileUrlResponseInner; +import com.azure.resourcemanager.appplatform.models.DeploymentInstance; +import com.azure.resourcemanager.appplatform.models.DeploymentResourceProperties; +import com.azure.resourcemanager.appplatform.models.DeploymentResourceStatus; +import com.azure.resourcemanager.appplatform.models.DeploymentSettings; +import com.azure.resourcemanager.appplatform.models.ResourceUploadDefinition; +import com.azure.resourcemanager.appplatform.models.RuntimeVersion; +import com.azure.resourcemanager.appplatform.models.SpringApp; +import com.azure.resourcemanager.appplatform.models.SpringAppDeployment; +import com.azure.resourcemanager.appplatform.models.UserSourceInfo; +import com.azure.resourcemanager.appplatform.models.UserSourceType; +import com.azure.resourcemanager.resources.fluentcore.arm.models.implementation.ExternalChildResourceImpl; +import com.azure.resourcemanager.resources.fluentcore.model.Indexable; +import com.azure.storage.file.share.ShareFileAsyncClient; +import com.azure.storage.file.share.ShareFileClientBuilder; +import org.apache.commons.compress.archivers.tar.TarArchiveEntry; +import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream; +import org.apache.commons.compress.utils.IOUtils; +import reactor.core.publisher.Mono; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.stream.Collectors; +import java.util.zip.GZIPOutputStream; + +public class SpringAppDeploymentImpl + extends ExternalChildResourceImpl + implements SpringAppDeployment, SpringAppDeployment.Definition, SpringAppDeployment.Update { + private static final int BLOCK_SIZE = 4 * 1024 * 1024; // 4MB + private final SpringAppDeploymentsImpl client; + private DeploymentSettings originalDeploymentSettings; + + SpringAppDeploymentImpl(String name, SpringAppImpl parent, + DeploymentResourceInner innerObject, SpringAppDeploymentsImpl client) { + super(name, parent, innerObject); + this.client = client; + } + + @Override + public String appName() { + if (inner().properties() == null) { + return null; + } + return inner().properties().appName(); + } + + @Override + public DeploymentSettings settings() { + if (inner().properties() == null) { + return null; + } + return inner().properties().deploymentSettings(); + } + + @Override + public DeploymentResourceStatus status() { + if (inner().properties() == null) { + return null; + } + return inner().properties().status(); + } + + @Override + public boolean isActive() { + if (inner().properties() == null) { + return false; + } + return inner().properties().active(); + } + + @Override + public OffsetDateTime createdTime() { + if (inner().properties() == null) { + return null; + } + return inner().properties().createdTime(); + } + + @Override + public List instances() { + if (inner().properties() == null) { + return null; + } + return inner().properties().instances(); + } + + @Override + public String getLogFileUrl() { + return getLogFileUrlAsync().block(); + } + + @Override + public Mono getLogFileUrlAsync() { + return manager().inner().getDeployments().getLogFileUrlAsync( + parent().parent().resourceGroupName(), parent().parent().name(), parent().name(), name() + ) + .map(LogFileUrlResponseInner::url); + } + + private void ensureDeploySettings() { + if (inner().properties() == null) { + inner().withProperties(new DeploymentResourceProperties()); + } + if (inner().properties().deploymentSettings() == null) { + inner().properties().withDeploymentSettings(new DeploymentSettings()); + } + } + + private void ensureSource() { + if (inner().properties() == null) { + inner().withProperties(new DeploymentResourceProperties()); + } + if (inner().properties().source() == null) { + inner().properties().withSource(new UserSourceInfo()); + } + } + + private File compressSource(File sourceFolder) throws IOException { + File compressFile = File.createTempFile("java_package", "tar.gz"); + compressFile.deleteOnExit(); + try (TarArchiveOutputStream tarArchiveOutputStream = new TarArchiveOutputStream( + new GZIPOutputStream(new FileOutputStream(compressFile)))) { + tarArchiveOutputStream.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU); + + for (Path sourceFile : Files.walk(sourceFolder.toPath()).collect(Collectors.toList())) { + String relativePath = sourceFolder.toPath().relativize(sourceFile).toString(); + TarArchiveEntry entry = new TarArchiveEntry(sourceFile.toFile(), relativePath); + if (sourceFile.toFile().isFile()) { + try (InputStream inputStream = new FileInputStream(sourceFile.toFile())) { + tarArchiveOutputStream.putArchiveEntry(entry); + IOUtils.copy(inputStream, tarArchiveOutputStream); + tarArchiveOutputStream.closeArchiveEntry(); + } + } else { + tarArchiveOutputStream.putArchiveEntry(entry); + tarArchiveOutputStream.closeArchiveEntry(); + } + } + } + return compressFile; + } + + private ShareFileAsyncClient createShareFileAsyncClient(ResourceUploadDefinition option) { + return new ShareFileClientBuilder() + .endpoint(option.uploadUrl()) + .httpClient(manager().httpPipeline().getHttpClient()) + .buildFileAsyncClient(); + } + + private Mono uploadToStorage(File source, ResourceUploadDefinition option) { + inner().properties().source().withRelativePath(option.relativePath()); + try { + ShareFileAsyncClient shareFileAsyncClient = createShareFileAsyncClient(option); + return shareFileAsyncClient.create(source.length()) + .flatMap(fileInfo -> shareFileAsyncClient.uploadFromFile(source.getAbsolutePath())) + .then(Mono.empty()); + } catch (Exception e) { + return Mono.error(e); + } + } + + @Override + public SpringAppDeploymentImpl withJarFile(File jar) { + ensureSource(); + inner().properties().source().withType(UserSourceType.JAR); + this.addDependency( + context -> parent().getResourceUploadUrlAsync() + .flatMap(option -> uploadToStorage(jar, option) + .then(context.voidMono())) + ); + return this; + } + + @Override + public SpringAppDeploymentImpl withSourceCodeFolder(File sourceCodeFolder) { + ensureSource(); + inner().properties().source().withType(UserSourceType.SOURCE); + this.addDependency( + context -> parent().getResourceUploadUrlAsync() + .flatMap(option -> { + try { + return uploadToStorage(compressSource(sourceCodeFolder), option); + } catch (Exception e) { + return Mono.error(e); + } + }) + .then(context.voidMono()) + ); + return this; + } + + @Override + public SpringAppDeploymentImpl withExistingSource(UserSourceType type, String relativePath) { + ensureSource(); + inner().properties().source().withType(type); + inner().properties().source().withRelativePath(relativePath); + return this; + } + + @Override + public SpringAppDeploymentImpl withSourceCodeTarGzFile(File sourceCodeTarGz) { + ensureSource(); + inner().properties().source().withType(UserSourceType.SOURCE); + this.addDependency( + context -> parent().getResourceUploadUrlAsync() + .flatMap(option -> uploadToStorage(sourceCodeTarGz, option) + .then(context.voidMono())) + ); + return this; + } + + @Override + public SpringAppDeploymentImpl withTargetModule(String moduleName) { + ensureSource(); + inner().properties().source().withArtifactSelector(moduleName); + return this; + } + + @Override + public SpringAppDeploymentImpl withSingleModule() { + ensureSource(); + inner().properties().source().withArtifactSelector(null); + return this; + } + + @Override + public SpringAppDeploymentImpl withSettingsFromActiveDeployment() { + this.addDependency( + context -> client.getByNameAsync(parent().activeDeployment()) + .map(deployment -> { + originalDeploymentSettings = deployment.settings(); + return (Indexable) deployment; + }) + ); + return this; + } + + @Override + public SpringAppDeploymentImpl withSettingsFromDeployment(SpringAppDeployment deployment) { + originalDeploymentSettings = deployment.settings(); + return this; + } + + @Override + public SpringAppDeploymentImpl withSettingsFromDeployment(String deploymentName) { + this.addDependency( + context -> client.getByNameAsync(deploymentName) + .map(deployment -> { + originalDeploymentSettings = deployment.settings(); + return (Indexable) deployment; + }) + ); + return this; + } + + @Override + public SpringAppDeploymentImpl withCustomSetting() { + ensureDeploySettings(); + inner().properties().withDeploymentSettings(new DeploymentSettings()); + return this; + } + + @Override + public SpringAppDeploymentImpl withInstance(int count) { + ensureDeploySettings(); + inner().properties().deploymentSettings().withInstanceCount(count); + return this; + } + + @Override + public SpringAppDeploymentImpl withCpu(int cpuCount) { + ensureDeploySettings(); + inner().properties().deploymentSettings().withCpu(cpuCount); + return this; + } + + @Override + public SpringAppDeploymentImpl withMemory(int sizeInGB) { + ensureDeploySettings(); + inner().properties().deploymentSettings().withMemoryInGB(sizeInGB); + return this; + } + + @Override + public SpringAppDeploymentImpl withRuntime(RuntimeVersion version) { + ensureDeploySettings(); + inner().properties().deploymentSettings().withRuntimeVersion(version); + return this; + } + + @Override + public SpringAppDeploymentImpl withJvmOptions(String jvmOptions) { + ensureDeploySettings(); + inner().properties().deploymentSettings().withJvmOptions(jvmOptions); + return this; + } + + private void ensureEnvironments() { + ensureDeploySettings(); + if (inner().properties().deploymentSettings().environmentVariables() == null) { + inner().properties().deploymentSettings().withEnvironmentVariables(new HashMap<>()); + } + } + + @Override + public SpringAppDeploymentImpl withEnvironment(String key, String value) { + ensureEnvironments(); + inner().properties().deploymentSettings().environmentVariables().put(key, value); + return this; + } + + @Override + public SpringAppDeploymentImpl withoutEnvironment(String key) { + ensureEnvironments(); + inner().properties().deploymentSettings().environmentVariables().remove(key); + return this; + } + + @Override + public SpringAppDeploymentImpl withVersionName(String versionName) { + ensureSource(); + inner().properties().source().withVersion(versionName); + return this; + } + + @Override + public SpringAppDeploymentImpl withActivation() { + this.addPostRunDependent( + context -> parent().update().withActiveDeployment(name()).applyAsync() + .map(app -> (Indexable) app) + ); + return this; + } + + @Override + public Mono createResourceAsync() { + if (originalDeploymentSettings != null) { + ensureDeploySettings(); + inner().properties().withDeploymentSettings(originalDeploymentSettings); + } + return manager().inner().getDeployments().createOrUpdateAsync( + parent().parent().resourceGroupName(), parent().parent().name(), + parent().name(), name(), inner().properties() + ) + .map(inner -> { + originalDeploymentSettings = null; + setInner(inner); + return this; + }); + } + + @Override + public Mono updateResourceAsync() { + if (originalDeploymentSettings != null) { + ensureDeploySettings(); + inner().properties().withDeploymentSettings(originalDeploymentSettings); + } + return manager().inner().getDeployments().updateAsync( + parent().parent().resourceGroupName(), parent().parent().name(), + parent().name(), name(), inner().properties() + ) + .map(inner -> { + originalDeploymentSettings = null; + setInner(inner); + return this; + }); + } + + @Override + public Mono deleteResourceAsync() { + return manager().inner().getDeployments().deleteAsync( + parent().parent().resourceGroupName(), parent().parent().name(), parent().name(), name() + ); + } + + @Override + protected Mono getInnerAsync() { + return manager().inner().getDeployments().getAsync( + parent().parent().resourceGroupName(), parent().parent().name(), parent().name(), name() + ); + } + + @Override + public String id() { + return inner().id(); + } + + @Override + public SpringAppDeploymentImpl update() { + prepareUpdate(); + return this; + } + + private AppPlatformManager manager() { + return parent().manager(); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/implementation/SpringAppDeploymentsImpl.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/implementation/SpringAppDeploymentsImpl.java new file mode 100644 index 000000000000..e1cc32e5e3c1 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/implementation/SpringAppDeploymentsImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.appplatform.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.resourcemanager.appplatform.AppPlatformManager; +import com.azure.resourcemanager.appplatform.fluent.DeploymentsClient; +import com.azure.resourcemanager.appplatform.fluent.inner.DeploymentResourceInner; +import com.azure.resourcemanager.appplatform.models.SpringApp; +import com.azure.resourcemanager.appplatform.models.SpringAppDeployment; +import com.azure.resourcemanager.appplatform.models.SpringAppDeployments; +import com.azure.resourcemanager.resources.fluentcore.arm.ResourceUtils; +import com.azure.resourcemanager.resources.fluentcore.arm.collection.implementation.ExternalChildResourcesNonCachedImpl; +import reactor.core.publisher.Mono; + +public class SpringAppDeploymentsImpl + extends ExternalChildResourcesNonCachedImpl< + SpringAppDeploymentImpl, SpringAppDeployment, DeploymentResourceInner, SpringAppImpl, SpringApp> + implements SpringAppDeployments { + + SpringAppDeploymentsImpl(SpringAppImpl parent) { + super(parent, parent.taskGroup(), "SpringAppDeployment"); + } + + @Override + public SpringAppDeployment getById(String id) { + return getByIdAsync(id).block(); + } + + @Override + public Mono getByIdAsync(String id) { + return getByNameAsync(ResourceUtils.nameFromResourceId(id)); + } + + @Override + public SpringAppDeployment getByName(String name) { + return getByNameAsync(name).block(); + } + + @Override + public Mono getByNameAsync(String name) { + return inner().getAsync(parent().parent().resourceGroupName(), parent().parent().name(), parent().name(), name) + .map(this::wrapModel); + } + + @Override + public AppPlatformManager manager() { + return parent().parent().manager(); + } + + @Override + public SpringAppImpl parent() { + return super.getParent(); + } + + @Override + public SpringAppDeploymentImpl define(String name) { + return super.prepareIndependentDefine(wrapModel(name)); + } + + @Override + public void deleteById(String id) { + deleteByIdAsync(id).block(); + } + + @Override + public Mono deleteByIdAsync(String id) { + return deleteByNameAsync(ResourceUtils.nameFromResourceId(id)); + } + + @Override + public void deleteByName(String name) { + deleteByNameAsync(name).block(); + } + + @Override + public Mono deleteByNameAsync(String name) { + return inner().deleteAsync( + parent().parent().resourceGroupName(), parent().parent().name(), parent().name(), name); + } + + @Override + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + @Override + public PagedFlux listAsync() { + return inner().listAsync(parent().parent().resourceGroupName(), parent().parent().name(), parent().name()) + .mapPage(this::wrapModel); + } + + private SpringAppDeploymentImpl wrapModel(String name) { + return new SpringAppDeploymentImpl(name, parent(), new DeploymentResourceInner(), this); + } + + private SpringAppDeploymentImpl wrapModel(DeploymentResourceInner inner) { + return inner == null ? null : new SpringAppDeploymentImpl(inner.name(), parent(), inner, this); + } + + @Override + public DeploymentsClient inner() { + return manager().inner().getDeployments(); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/implementation/SpringAppImpl.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/implementation/SpringAppImpl.java new file mode 100644 index 000000000000..6d811a0eb8d4 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/implementation/SpringAppImpl.java @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.appplatform.implementation; + +import com.azure.resourcemanager.appplatform.AppPlatformManager; +import com.azure.resourcemanager.appplatform.fluent.inner.AppResourceInner; +import com.azure.resourcemanager.appplatform.models.AppResourceProperties; +import com.azure.resourcemanager.appplatform.models.ManagedIdentityProperties; +import com.azure.resourcemanager.appplatform.models.PersistentDisk; +import com.azure.resourcemanager.appplatform.models.ResourceUploadDefinition; +import com.azure.resourcemanager.appplatform.models.SpringApp; +import com.azure.resourcemanager.appplatform.models.SpringAppDeployment; +import com.azure.resourcemanager.appplatform.models.SpringAppDeployments; +import com.azure.resourcemanager.appplatform.models.SpringService; +import com.azure.resourcemanager.appplatform.models.TemporaryDisk; +import com.azure.resourcemanager.appplatform.models.UserSourceType; +import com.azure.resourcemanager.resources.fluentcore.arm.models.implementation.ExternalChildResourceImpl; +import com.azure.resourcemanager.resources.fluentcore.model.Creatable; +import reactor.core.publisher.Mono; + +import java.io.File; +import java.time.OffsetDateTime; + +public class SpringAppImpl + extends ExternalChildResourceImpl + implements SpringApp, SpringApp.Definition, SpringApp.Update { + private Creatable springAppDeploymentToCreate = null; + + SpringAppImpl(String name, SpringServiceImpl parent, AppResourceInner innerObject) { + super(name, parent, innerObject); + } + + @Override + public boolean isPublic() { + if (inner().properties() == null) { + return false; + } + return inner().properties().publicProperty(); + } + + @Override + public boolean isHttpsOnly() { + if (inner().properties() == null) { + return false; + } + return inner().properties().httpsOnly(); + } + + @Override + public String url() { + if (inner().properties() == null) { + return null; + } + return inner().properties().url(); + } + + @Override + public TemporaryDisk temporaryDisk() { + if (inner().properties() == null) { + return null; + } + return inner().properties().temporaryDisk(); + } + + @Override + public PersistentDisk persistentDisk() { + if (inner().properties() == null) { + return null; + } + return inner().properties().persistentDisk(); + } + + @Override + public ManagedIdentityProperties identity() { + return inner().identity(); + } + + @Override + public OffsetDateTime createdTime() { + if (inner().properties() == null) { + return null; + } + return inner().properties().createdTime(); + } + + @Override + public String activeDeployment() { + if (inner().properties() == null) { + return null; + } + return inner().properties().activeDeploymentName(); + } + + @Override + public SpringAppDeployments deployments() { + return new SpringAppDeploymentsImpl(this); + } + + @Override + public Mono getResourceUploadUrlAsync() { + return manager().inner().getApps().getResourceUploadUrlAsync( + parent().resourceGroupName(), parent().name(), name()); + } + + @Override + public ResourceUploadDefinition getResourceUploadUrl() { + return getResourceUploadUrlAsync().block(); + } + + private void ensureProperty() { + if (inner().properties() == null) { + inner().withProperties(new AppResourceProperties()); + } + } + + @Override + public SpringAppImpl withPublicEndpoint() { + ensureProperty(); + inner().properties().withPublicProperty(true); + return this; + } + + @Override + public SpringAppImpl withoutPublicEndpoint() { + ensureProperty(); + inner().properties().withPublicProperty(false); + return this; + } + + @Override + public SpringAppImpl withCustomDomain(String domain) { + ensureProperty(); + inner().properties().withFqdn(domain); + return this; + } + + @Override + public SpringAppImpl withoutCustomDomain() { + ensureProperty(); + inner().properties().withFqdn(null); + return this; + } + + @Override + public SpringAppImpl withHttpsOnly() { + ensureProperty(); + inner().properties().withHttpsOnly(true); + return this; + } + + @Override + public SpringAppImpl withoutHttpsOnly() { + ensureProperty(); + inner().properties().withHttpsOnly(false); + return this; + } + + @Override + public SpringAppImpl withTemporaryDisk(int sizeInGB, String mountPath) { + ensureProperty(); + inner().properties().withTemporaryDisk(new TemporaryDisk().withSizeInGB(sizeInGB).withMountPath(mountPath)); + return this; + } + + @Override + public SpringAppImpl withoutTemporaryDisk() { + ensureProperty(); + inner().properties().withTemporaryDisk(null); + return this; + } + + @Override + public SpringAppImpl withPersistentDisk(int sizeInGB, String mountPath) { + ensureProperty(); + inner().properties().withPersistentDisk(new PersistentDisk().withSizeInGB(sizeInGB).withMountPath(mountPath)); + return this; + } + + @Override + public SpringAppImpl withoutPersistentDisk() { + ensureProperty(); + inner().properties().withPersistentDisk(null); + return this; + } + + @Override + public SpringAppImpl withActiveDeployment(String name) { + ensureProperty(); + inner().properties().withActiveDeploymentName(name); + return this; + } + + @Override + public SpringAppImpl withoutDeployment(String name) { + this.addPostRunDependent( + context -> deployments().deleteByNameAsync(name) + .then(context.voidMono()) + ); + return this; + } + + @Override + public SpringAppImpl deployJar(String name, File jarFile) { + ensureProperty(); + inner().properties().withActiveDeploymentName(name); + springAppDeploymentToCreate = deployments().define(name) + .withJarFile(jarFile) + .withCustomSetting(); + return this; + } + + @Override + public SpringAppImpl deploySource(String name, File sourceCodeFolder, String targetModule) { + ensureProperty(); + inner().properties().withActiveDeploymentName(name); + springAppDeploymentToCreate = deployments().define(name) + .withSourceCodeFolder(sourceCodeFolder) + .withTargetModule(targetModule) + .withCustomSetting(); + return this; + } + + @Override + public Mono createResourceAsync() { + if (springAppDeploymentToCreate == null) { + String defaultDeploymentName = "default"; + withActiveDeployment(defaultDeploymentName); + springAppDeploymentToCreate = deployments().define(defaultDeploymentName) + .withExistingSource(UserSourceType.JAR, String.format("<%s>", defaultDeploymentName)) + .withCustomSetting(); + } + return manager().inner().getApps().createOrUpdateAsync( + parent().resourceGroupName(), parent().name(), name(), new AppResourceInner()) + .flatMap(inner -> updateResourceAsync()); + } + + @Override + public Mono updateResourceAsync() { + Mono createDeployment; + if (springAppDeploymentToCreate != null) { + createDeployment = springAppDeploymentToCreate.createAsync().last(); + } else { + createDeployment = Mono.empty(); + } + return createDeployment + .then( + manager().inner().getApps().updateAsync( + parent().resourceGroupName(), parent().name(), name(), inner() + ) + .map(inner -> { + setInner(inner); + springAppDeploymentToCreate = null; + return this; + })); + } + + @Override + public Mono deleteResourceAsync() { + return manager().inner().getApps().deleteAsync(parent().resourceGroupName(), parent().name(), name()); + } + + @Override + protected Mono getInnerAsync() { + return manager().inner().getApps().getAsync(parent().resourceGroupName(), parent().name(), name()); + } + + @Override + public String id() { + return inner().id(); + } + + @Override + public SpringAppImpl update() { + prepareUpdate(); + return this; + } + + public AppPlatformManager manager() { + return parent().manager(); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/implementation/SpringAppsImpl.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/implementation/SpringAppsImpl.java new file mode 100644 index 000000000000..3bf35e72e449 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/implementation/SpringAppsImpl.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.appplatform.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.resourcemanager.appplatform.AppPlatformManager; +import com.azure.resourcemanager.appplatform.fluent.AppsClient; +import com.azure.resourcemanager.appplatform.fluent.inner.AppResourceInner; +import com.azure.resourcemanager.appplatform.models.SpringApp; +import com.azure.resourcemanager.appplatform.models.SpringApps; +import com.azure.resourcemanager.appplatform.models.SpringService; +import com.azure.resourcemanager.resources.fluentcore.arm.ResourceUtils; +import com.azure.resourcemanager.resources.fluentcore.arm.collection.implementation.ExternalChildResourcesNonCachedImpl; +import reactor.core.publisher.Mono; + +public class SpringAppsImpl + extends ExternalChildResourcesNonCachedImpl< + SpringAppImpl, SpringApp, AppResourceInner, SpringServiceImpl, SpringService> + implements SpringApps { + + SpringAppsImpl(SpringServiceImpl parent) { + super(parent, parent.taskGroup(), "SpringApp"); + } + + @Override + public SpringApp getById(String id) { + return getByIdAsync(id).block(); + } + + @Override + public Mono getByIdAsync(String id) { + return getByNameAsync(ResourceUtils.nameFromResourceId(id)); + } + + @Override + public SpringApp getByName(String name) { + return getByNameAsync(name).block(); + } + + @Override + public Mono getByNameAsync(String name) { + return inner().getAsync(parent().resourceGroupName(), parent().name(), name) + .map(this::wrapModel); + } + + @Override + public AppPlatformManager manager() { + return parent().manager(); + } + + @Override + public SpringServiceImpl parent() { + return super.getParent(); + } + + @Override + public SpringAppImpl define(String name) { + return super.prepareIndependentDefine(wrapModel(name)); + } + + @Override + public void deleteById(String id) { + deleteByIdAsync(id).block(); + } + + @Override + public Mono deleteByIdAsync(String id) { + return deleteByNameAsync(ResourceUtils.nameFromResourceId(id)); + } + + @Override + public void deleteByName(String name) { + deleteByNameAsync(name).block(); + } + + @Override + public Mono deleteByNameAsync(String name) { + return inner().deleteAsync(parent().resourceGroupName(), parent().name(), name); + } + + @Override + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + @Override + public PagedFlux listAsync() { + return inner().listAsync(parent().resourceGroupName(), parent().name()) + .mapPage(this::wrapModel); + } + + private SpringAppImpl wrapModel(AppResourceInner inner) { + return inner == null ? null : new SpringAppImpl(inner.name(), parent(), inner); + } + + private SpringAppImpl wrapModel(String name) { + return new SpringAppImpl(name, parent(), new AppResourceInner()); + } + + @Override + public AppsClient inner() { + return manager().inner().getApps(); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/implementation/SpringServiceImpl.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/implementation/SpringServiceImpl.java new file mode 100644 index 000000000000..5ac8e890fab1 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/implementation/SpringServiceImpl.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.appplatform.implementation; + +import com.azure.resourcemanager.appplatform.AppPlatformManager; +import com.azure.resourcemanager.appplatform.fluent.inner.ServiceResourceInner; +import com.azure.resourcemanager.appplatform.models.ClusterResourceProperties; +import com.azure.resourcemanager.appplatform.models.ConfigServerGitProperty; +import com.azure.resourcemanager.appplatform.models.ConfigServerProperties; +import com.azure.resourcemanager.appplatform.models.ConfigServerSettings; +import com.azure.resourcemanager.appplatform.models.Sku; +import com.azure.resourcemanager.appplatform.models.SpringApps; +import com.azure.resourcemanager.appplatform.models.SpringService; +import com.azure.resourcemanager.appplatform.models.TestKeyType; +import com.azure.resourcemanager.appplatform.models.TestKeys; +import com.azure.resourcemanager.appplatform.models.TraceProperties; +import com.azure.resourcemanager.resources.fluentcore.arm.models.implementation.GroupableResourceImpl; +import reactor.core.publisher.Mono; + +public class SpringServiceImpl + extends GroupableResourceImpl + implements SpringService, SpringService.Definition, SpringService.Update { + + SpringServiceImpl(String name, ServiceResourceInner innerObject, AppPlatformManager manager) { + super(name, innerObject, manager); + } + @Override + public Sku sku() { + return inner().sku(); + } + + @Override + public TraceProperties traceProperties() { + return inner().properties().trace(); + } + + @Override + public ConfigServerProperties serverProperties() { + return inner().properties().configServerProperties(); + } + + @Override + public SpringApps apps() { + return new SpringAppsImpl(this); + } + + @Override + public TestKeys listTestKeys() { + return listTestKeysAsync().block(); + } + + @Override + public Mono listTestKeysAsync() { + return manager().inner().getServices().listTestKeysAsync(resourceGroupName(), name()); + } + + @Override + public TestKeys regenerateTestKeys(TestKeyType keyType) { + return regenerateTestKeysAsync(keyType).block(); + } + + @Override + public Mono regenerateTestKeysAsync(TestKeyType keyType) { + return manager().inner().getServices().regenerateTestKeyAsync(resourceGroupName(), name(), keyType); + } + + @Override + public void disableTestEndpoint() { + disableTestEndpointAsync().block(); + } + + @Override + public Mono disableTestEndpointAsync() { + return manager().inner().getServices().disableTestEndpointAsync(resourceGroupName(), name()); + } + + @Override + public TestKeys enableTestEndpoint() { + return enableTestEndpointAsync().block(); + } + + @Override + public Mono enableTestEndpointAsync() { + return manager().inner().getServices().enableTestEndpointAsync(resourceGroupName(), name()); + } + + @Override + public SpringServiceImpl withSku(String skuName) { + return withSku(new Sku().withName(skuName)); + } + + @Override + public SpringServiceImpl withSku(String skuName, int capacity) { + return withSku(new Sku().withName(skuName).withCapacity(capacity)); + } + + @Override + public SpringServiceImpl withSku(Sku sku) { + inner().withSku(sku); + return this; + } + + @Override + public SpringServiceImpl withTracing(String appInsightInstrumentationKey) { + if (inner().properties() == null) { + inner().withProperties(new ClusterResourceProperties()); + } + inner().properties().withTrace( + new TraceProperties().withAppInsightInstrumentationKey(appInsightInstrumentationKey).withEnabled(true)); + return this; + } + + @Override + public SpringServiceImpl withoutTracing() { + if (inner().properties() == null) { + inner().withProperties(new ClusterResourceProperties()); + } + inner().properties().withTrace(new TraceProperties().withEnabled(false)); + return this; + } + + private void ensureGitConfig() { + if (inner().properties() == null) { + inner().withProperties(new ClusterResourceProperties()); + } + if (inner().properties().configServerProperties() == null) { + inner().properties().withConfigServerProperties(new ConfigServerProperties()); + } + if (inner().properties().configServerProperties().configServer() == null) { + inner().properties().configServerProperties().withConfigServer(new ConfigServerSettings()); + } + if (inner().properties().configServerProperties().configServer().gitProperty() == null) { + inner().properties().configServerProperties().configServer().withGitProperty(new ConfigServerGitProperty()); + } + } + + @Override + public SpringServiceImpl withGitUri(String uri) { + ensureGitConfig(); + inner().properties().configServerProperties().configServer().gitProperty().withUri(uri); + return this; + } + + @Override + public SpringServiceImpl withGitUriAndCredential(String uri, String username, String password) { + ensureGitConfig(); + inner().properties().configServerProperties().configServer().gitProperty() + .withUri(uri).withUsername(username).withPassword(password); + return this; + } + + @Override + public SpringServiceImpl withGitConfig(ConfigServerGitProperty gitConfig) { + ensureGitConfig(); + inner().properties().configServerProperties().configServer().withGitProperty(gitConfig); + return this; + } + + @Override + public SpringServiceImpl withoutGitConfig() { + ensureGitConfig(); + inner().properties().configServerProperties().configServer().withGitProperty(null); + return this; + } + + @Override + public Mono createResourceAsync() { + Mono createOrUpdate; + if (isInCreateMode()) { + createOrUpdate = manager().inner().getServices().createOrUpdateAsync(resourceGroupName(), name(), inner()); + } else { + createOrUpdate = manager().inner().getServices().updateAsync(resourceGroupName(), name(), inner()); + } + return createOrUpdate + .map(inner -> { + this.setInner(inner); + return this; + }); + } + + @Override + protected Mono getInnerAsync() { + return manager().inner().getServices().getByResourceGroupAsync(resourceGroupName(), name()); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/implementation/SpringServicesImpl.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/implementation/SpringServicesImpl.java new file mode 100644 index 000000000000..d48cd6be55a3 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/implementation/SpringServicesImpl.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.appplatform.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.resourcemanager.appplatform.AppPlatformManager; +import com.azure.resourcemanager.appplatform.fluent.ServicesClient; +import com.azure.resourcemanager.appplatform.fluent.inner.ServiceResourceInner; +import com.azure.resourcemanager.appplatform.models.ResourceSku; +import com.azure.resourcemanager.appplatform.models.SpringService; +import com.azure.resourcemanager.appplatform.models.SpringServices; +import com.azure.resourcemanager.resources.fluentcore.arm.collection.implementation.GroupableResourcesImpl; +import reactor.core.publisher.Mono; + +public class SpringServicesImpl + extends GroupableResourcesImpl< + SpringService, SpringServiceImpl, ServiceResourceInner, ServicesClient, AppPlatformManager> + implements SpringServices { + public SpringServicesImpl(AppPlatformManager manager) { + super(manager.inner().getServices(), manager); + } + + @Override + protected Mono getInnerAsync(String resourceGroupName, String name) { + return inner().getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Mono deleteInnerAsync(String resourceGroupName, String name) { + return inner().deleteAsync(resourceGroupName, name); + } + + @Override + protected SpringServiceImpl wrapModel(String name) { + return new SpringServiceImpl(name, new ServiceResourceInner(), manager()); + } + + @Override + protected SpringServiceImpl wrapModel(ServiceResourceInner inner) { + return inner == null ? null : new SpringServiceImpl(inner.name(), inner, manager()); + } + + @Override + public PagedIterable listSkus() { + return new PagedIterable<>(listSkusAsync()); + } + + @Override + public PagedFlux listSkusAsync() { + return manager().inner().getSkus().listAsync(); + } + + @Override + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + @Override + public PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return inner().listByResourceGroupAsync(resourceGroupName).mapPage(this::wrapModel); + } + + @Override + public SpringServiceImpl define(String name) { + return wrapModel(name); + } + + @Override + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + @Override + public PagedFlux listAsync() { + return inner().listAsync().mapPage(this::wrapModel); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/AppResourceProperties.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/AppResourceProperties.java new file mode 100644 index 000000000000..30ca64791bf8 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/AppResourceProperties.java @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The AppResourceProperties model. */ +@Fluent +public final class AppResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AppResourceProperties.class); + + /* + * Indicates whether the App exposes public endpoint + */ + @JsonProperty(value = "public") + private Boolean publicProperty; + + /* + * URL of the App + */ + @JsonProperty(value = "url", access = JsonProperty.Access.WRITE_ONLY) + private String url; + + /* + * Provisioning state of the App + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private AppResourceProvisioningState provisioningState; + + /* + * Name of the active deployment of the App + */ + @JsonProperty(value = "activeDeploymentName") + private String activeDeploymentName; + + /* + * Fully qualified dns Name. + */ + @JsonProperty(value = "fqdn") + private String fqdn; + + /* + * Indicate if only https is allowed. + */ + @JsonProperty(value = "httpsOnly") + private Boolean httpsOnly; + + /* + * Date time when the resource is created + */ + @JsonProperty(value = "createdTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createdTime; + + /* + * Temporary disk settings + */ + @JsonProperty(value = "temporaryDisk") + private TemporaryDisk temporaryDisk; + + /* + * Persistent disk settings + */ + @JsonProperty(value = "persistentDisk") + private PersistentDisk persistentDisk; + + /** + * Get the publicProperty property: Indicates whether the App exposes public endpoint. + * + * @return the publicProperty value. + */ + public Boolean publicProperty() { + return this.publicProperty; + } + + /** + * Set the publicProperty property: Indicates whether the App exposes public endpoint. + * + * @param publicProperty the publicProperty value to set. + * @return the AppResourceProperties object itself. + */ + public AppResourceProperties withPublicProperty(Boolean publicProperty) { + this.publicProperty = publicProperty; + return this; + } + + /** + * Get the url property: URL of the App. + * + * @return the url value. + */ + public String url() { + return this.url; + } + + /** + * Get the provisioningState property: Provisioning state of the App. + * + * @return the provisioningState value. + */ + public AppResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the activeDeploymentName property: Name of the active deployment of the App. + * + * @return the activeDeploymentName value. + */ + public String activeDeploymentName() { + return this.activeDeploymentName; + } + + /** + * Set the activeDeploymentName property: Name of the active deployment of the App. + * + * @param activeDeploymentName the activeDeploymentName value to set. + * @return the AppResourceProperties object itself. + */ + public AppResourceProperties withActiveDeploymentName(String activeDeploymentName) { + this.activeDeploymentName = activeDeploymentName; + return this; + } + + /** + * Get the fqdn property: Fully qualified dns Name. + * + * @return the fqdn value. + */ + public String fqdn() { + return this.fqdn; + } + + /** + * Set the fqdn property: Fully qualified dns Name. + * + * @param fqdn the fqdn value to set. + * @return the AppResourceProperties object itself. + */ + public AppResourceProperties withFqdn(String fqdn) { + this.fqdn = fqdn; + return this; + } + + /** + * Get the httpsOnly property: Indicate if only https is allowed. + * + * @return the httpsOnly value. + */ + public Boolean httpsOnly() { + return this.httpsOnly; + } + + /** + * Set the httpsOnly property: Indicate if only https is allowed. + * + * @param httpsOnly the httpsOnly value to set. + * @return the AppResourceProperties object itself. + */ + public AppResourceProperties withHttpsOnly(Boolean httpsOnly) { + this.httpsOnly = httpsOnly; + return this; + } + + /** + * Get the createdTime property: Date time when the resource is created. + * + * @return the createdTime value. + */ + public OffsetDateTime createdTime() { + return this.createdTime; + } + + /** + * Get the temporaryDisk property: Temporary disk settings. + * + * @return the temporaryDisk value. + */ + public TemporaryDisk temporaryDisk() { + return this.temporaryDisk; + } + + /** + * Set the temporaryDisk property: Temporary disk settings. + * + * @param temporaryDisk the temporaryDisk value to set. + * @return the AppResourceProperties object itself. + */ + public AppResourceProperties withTemporaryDisk(TemporaryDisk temporaryDisk) { + this.temporaryDisk = temporaryDisk; + return this; + } + + /** + * Get the persistentDisk property: Persistent disk settings. + * + * @return the persistentDisk value. + */ + public PersistentDisk persistentDisk() { + return this.persistentDisk; + } + + /** + * Set the persistentDisk property: Persistent disk settings. + * + * @param persistentDisk the persistentDisk value to set. + * @return the AppResourceProperties object itself. + */ + public AppResourceProperties withPersistentDisk(PersistentDisk persistentDisk) { + this.persistentDisk = persistentDisk; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (temporaryDisk() != null) { + temporaryDisk().validate(); + } + if (persistentDisk() != null) { + persistentDisk().validate(); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/AppResourceProvisioningState.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/AppResourceProvisioningState.java new file mode 100644 index 000000000000..8c0a7f688cd1 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/AppResourceProvisioningState.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.appplatform.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AppResourceProvisioningState. */ +public final class AppResourceProvisioningState extends ExpandableStringEnum { + /** Static value Succeeded for AppResourceProvisioningState. */ + public static final AppResourceProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for AppResourceProvisioningState. */ + public static final AppResourceProvisioningState FAILED = fromString("Failed"); + + /** Static value Creating for AppResourceProvisioningState. */ + public static final AppResourceProvisioningState CREATING = fromString("Creating"); + + /** Static value Updating for AppResourceProvisioningState. */ + public static final AppResourceProvisioningState UPDATING = fromString("Updating"); + + /** + * Creates or finds a AppResourceProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding AppResourceProvisioningState. + */ + @JsonCreator + public static AppResourceProvisioningState fromString(String name) { + return fromString(name, AppResourceProvisioningState.class); + } + + /** @return known AppResourceProvisioningState values. */ + public static Collection values() { + return values(AppResourceProvisioningState.class); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/BindingResourceProperties.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/BindingResourceProperties.java new file mode 100644 index 000000000000..52deb17dbba9 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/BindingResourceProperties.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The BindingResourceProperties model. */ +@Fluent +public final class BindingResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BindingResourceProperties.class); + + /* + * The name of the bound resource + */ + @JsonProperty(value = "resourceName") + private String resourceName; + + /* + * The standard Azure resource type of the bound resource + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /* + * The Azure resource id of the bound resource + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /* + * The key of the bound resource + */ + @JsonProperty(value = "key") + private String key; + + /* + * Binding parameters of the Binding resource + */ + @JsonProperty(value = "bindingParameters") + private Map bindingParameters; + + /* + * The generated Spring Boot property file for this binding. The secret + * will be deducted. + */ + @JsonProperty(value = "generatedProperties", access = JsonProperty.Access.WRITE_ONLY) + private String generatedProperties; + + /* + * Creation time of the Binding resource + */ + @JsonProperty(value = "createdAt", access = JsonProperty.Access.WRITE_ONLY) + private String createdAt; + + /* + * Update time of the Binding resource + */ + @JsonProperty(value = "updatedAt", access = JsonProperty.Access.WRITE_ONLY) + private String updatedAt; + + /** + * Get the resourceName property: The name of the bound resource. + * + * @return the resourceName value. + */ + public String resourceName() { + return this.resourceName; + } + + /** + * Set the resourceName property: The name of the bound resource. + * + * @param resourceName the resourceName value to set. + * @return the BindingResourceProperties object itself. + */ + public BindingResourceProperties withResourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + + /** + * Get the resourceType property: The standard Azure resource type of the bound resource. + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the resourceType property: The standard Azure resource type of the bound resource. + * + * @param resourceType the resourceType value to set. + * @return the BindingResourceProperties object itself. + */ + public BindingResourceProperties withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get the resourceId property: The Azure resource id of the bound resource. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: The Azure resource id of the bound resource. + * + * @param resourceId the resourceId value to set. + * @return the BindingResourceProperties object itself. + */ + public BindingResourceProperties withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the key property: The key of the bound resource. + * + * @return the key value. + */ + public String key() { + return this.key; + } + + /** + * Set the key property: The key of the bound resource. + * + * @param key the key value to set. + * @return the BindingResourceProperties object itself. + */ + public BindingResourceProperties withKey(String key) { + this.key = key; + return this; + } + + /** + * Get the bindingParameters property: Binding parameters of the Binding resource. + * + * @return the bindingParameters value. + */ + public Map bindingParameters() { + return this.bindingParameters; + } + + /** + * Set the bindingParameters property: Binding parameters of the Binding resource. + * + * @param bindingParameters the bindingParameters value to set. + * @return the BindingResourceProperties object itself. + */ + public BindingResourceProperties withBindingParameters(Map bindingParameters) { + this.bindingParameters = bindingParameters; + return this; + } + + /** + * Get the generatedProperties property: The generated Spring Boot property file for this binding. The secret will + * be deducted. + * + * @return the generatedProperties value. + */ + public String generatedProperties() { + return this.generatedProperties; + } + + /** + * Get the createdAt property: Creation time of the Binding resource. + * + * @return the createdAt value. + */ + public String createdAt() { + return this.createdAt; + } + + /** + * Get the updatedAt property: Update time of the Binding resource. + * + * @return the updatedAt value. + */ + public String updatedAt() { + return this.updatedAt; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/CertificateProperties.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/CertificateProperties.java new file mode 100644 index 000000000000..cbc1c6d505c5 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/CertificateProperties.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The CertificateProperties model. */ +@Fluent +public final class CertificateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificateProperties.class); + + /* + * The thumbprint of certificate. + */ + @JsonProperty(value = "thumbprint", access = JsonProperty.Access.WRITE_ONLY) + private String thumbprint; + + /* + * The vault uri of user key vault. + */ + @JsonProperty(value = "vaultUri", required = true) + private String vaultUri; + + /* + * The certificate name of key vault. + */ + @JsonProperty(value = "keyVaultCertName", required = true) + private String keyVaultCertName; + + /* + * The certificate version of key vault. + */ + @JsonProperty(value = "certVersion") + private String certVersion; + + /* + * The issuer of certificate. + */ + @JsonProperty(value = "issuer", access = JsonProperty.Access.WRITE_ONLY) + private String issuer; + + /* + * The issue date of certificate. + */ + @JsonProperty(value = "issuedDate", access = JsonProperty.Access.WRITE_ONLY) + private String issuedDate; + + /* + * The expiration date of certificate. + */ + @JsonProperty(value = "expirationDate", access = JsonProperty.Access.WRITE_ONLY) + private String expirationDate; + + /* + * The activate date of certificate. + */ + @JsonProperty(value = "activateDate", access = JsonProperty.Access.WRITE_ONLY) + private String activateDate; + + /* + * The subject name of certificate. + */ + @JsonProperty(value = "subjectName", access = JsonProperty.Access.WRITE_ONLY) + private String subjectName; + + /* + * The domain list of certificate. + */ + @JsonProperty(value = "dnsNames", access = JsonProperty.Access.WRITE_ONLY) + private List dnsNames; + + /** + * Get the thumbprint property: The thumbprint of certificate. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Get the vaultUri property: The vault uri of user key vault. + * + * @return the vaultUri value. + */ + public String vaultUri() { + return this.vaultUri; + } + + /** + * Set the vaultUri property: The vault uri of user key vault. + * + * @param vaultUri the vaultUri value to set. + * @return the CertificateProperties object itself. + */ + public CertificateProperties withVaultUri(String vaultUri) { + this.vaultUri = vaultUri; + return this; + } + + /** + * Get the keyVaultCertName property: The certificate name of key vault. + * + * @return the keyVaultCertName value. + */ + public String keyVaultCertName() { + return this.keyVaultCertName; + } + + /** + * Set the keyVaultCertName property: The certificate name of key vault. + * + * @param keyVaultCertName the keyVaultCertName value to set. + * @return the CertificateProperties object itself. + */ + public CertificateProperties withKeyVaultCertName(String keyVaultCertName) { + this.keyVaultCertName = keyVaultCertName; + return this; + } + + /** + * Get the certVersion property: The certificate version of key vault. + * + * @return the certVersion value. + */ + public String certVersion() { + return this.certVersion; + } + + /** + * Set the certVersion property: The certificate version of key vault. + * + * @param certVersion the certVersion value to set. + * @return the CertificateProperties object itself. + */ + public CertificateProperties withCertVersion(String certVersion) { + this.certVersion = certVersion; + return this; + } + + /** + * Get the issuer property: The issuer of certificate. + * + * @return the issuer value. + */ + public String issuer() { + return this.issuer; + } + + /** + * Get the issuedDate property: The issue date of certificate. + * + * @return the issuedDate value. + */ + public String issuedDate() { + return this.issuedDate; + } + + /** + * Get the expirationDate property: The expiration date of certificate. + * + * @return the expirationDate value. + */ + public String expirationDate() { + return this.expirationDate; + } + + /** + * Get the activateDate property: The activate date of certificate. + * + * @return the activateDate value. + */ + public String activateDate() { + return this.activateDate; + } + + /** + * Get the subjectName property: The subject name of certificate. + * + * @return the subjectName value. + */ + public String subjectName() { + return this.subjectName; + } + + /** + * Get the dnsNames property: The domain list of certificate. + * + * @return the dnsNames value. + */ + public List dnsNames() { + return this.dnsNames; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (vaultUri() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property vaultUri in model CertificateProperties")); + } + if (keyVaultCertName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property keyVaultCertName in model CertificateProperties")); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ClusterResourceProperties.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ClusterResourceProperties.java new file mode 100644 index 000000000000..fde846a738c5 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ClusterResourceProperties.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ClusterResourceProperties model. */ +@Fluent +public final class ClusterResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ClusterResourceProperties.class); + + /* + * Provisioning state of the Service + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * Config server git properties of the Service + */ + @JsonProperty(value = "configServerProperties") + private ConfigServerProperties configServerProperties; + + /* + * Trace properties of the Service + */ + @JsonProperty(value = "trace") + private TraceProperties trace; + + /* + * Version of the Service + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private Integer version; + + /* + * ServiceInstanceEntity GUID which uniquely identifies a created resource + */ + @JsonProperty(value = "serviceId", access = JsonProperty.Access.WRITE_ONLY) + private String serviceId; + + /** + * Get the provisioningState property: Provisioning state of the Service. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the configServerProperties property: Config server git properties of the Service. + * + * @return the configServerProperties value. + */ + public ConfigServerProperties configServerProperties() { + return this.configServerProperties; + } + + /** + * Set the configServerProperties property: Config server git properties of the Service. + * + * @param configServerProperties the configServerProperties value to set. + * @return the ClusterResourceProperties object itself. + */ + public ClusterResourceProperties withConfigServerProperties(ConfigServerProperties configServerProperties) { + this.configServerProperties = configServerProperties; + return this; + } + + /** + * Get the trace property: Trace properties of the Service. + * + * @return the trace value. + */ + public TraceProperties trace() { + return this.trace; + } + + /** + * Set the trace property: Trace properties of the Service. + * + * @param trace the trace value to set. + * @return the ClusterResourceProperties object itself. + */ + public ClusterResourceProperties withTrace(TraceProperties trace) { + this.trace = trace; + return this; + } + + /** + * Get the version property: Version of the Service. + * + * @return the version value. + */ + public Integer version() { + return this.version; + } + + /** + * Get the serviceId property: ServiceInstanceEntity GUID which uniquely identifies a created resource. + * + * @return the serviceId value. + */ + public String serviceId() { + return this.serviceId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (configServerProperties() != null) { + configServerProperties().validate(); + } + if (trace() != null) { + trace().validate(); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ConfigServerGitProperty.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ConfigServerGitProperty.java new file mode 100644 index 000000000000..042d8f5781c5 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ConfigServerGitProperty.java @@ -0,0 +1,293 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The ConfigServerGitProperty model. */ +@Fluent +public final class ConfigServerGitProperty { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConfigServerGitProperty.class); + + /* + * Repositories of git. + */ + @JsonProperty(value = "repositories") + private List repositories; + + /* + * URI of the repository + */ + @JsonProperty(value = "uri", required = true) + private String uri; + + /* + * Label of the repository + */ + @JsonProperty(value = "label") + private String label; + + /* + * Searching path of the repository + */ + @JsonProperty(value = "searchPaths") + private List searchPaths; + + /* + * Username of git repository basic auth. + */ + @JsonProperty(value = "username") + private String username; + + /* + * Password of git repository basic auth. + */ + @JsonProperty(value = "password") + private String password; + + /* + * Public sshKey of git repository. + */ + @JsonProperty(value = "hostKey") + private String hostKey; + + /* + * SshKey algorithm of git repository. + */ + @JsonProperty(value = "hostKeyAlgorithm") + private String hostKeyAlgorithm; + + /* + * Private sshKey algorithm of git repository. + */ + @JsonProperty(value = "privateKey") + private String privateKey; + + /* + * Strict host key checking or not. + */ + @JsonProperty(value = "strictHostKeyChecking") + private Boolean strictHostKeyChecking; + + /** + * Get the repositories property: Repositories of git. + * + * @return the repositories value. + */ + public List repositories() { + return this.repositories; + } + + /** + * Set the repositories property: Repositories of git. + * + * @param repositories the repositories value to set. + * @return the ConfigServerGitProperty object itself. + */ + public ConfigServerGitProperty withRepositories(List repositories) { + this.repositories = repositories; + return this; + } + + /** + * Get the uri property: URI of the repository. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: URI of the repository. + * + * @param uri the uri value to set. + * @return the ConfigServerGitProperty object itself. + */ + public ConfigServerGitProperty withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get the label property: Label of the repository. + * + * @return the label value. + */ + public String label() { + return this.label; + } + + /** + * Set the label property: Label of the repository. + * + * @param label the label value to set. + * @return the ConfigServerGitProperty object itself. + */ + public ConfigServerGitProperty withLabel(String label) { + this.label = label; + return this; + } + + /** + * Get the searchPaths property: Searching path of the repository. + * + * @return the searchPaths value. + */ + public List searchPaths() { + return this.searchPaths; + } + + /** + * Set the searchPaths property: Searching path of the repository. + * + * @param searchPaths the searchPaths value to set. + * @return the ConfigServerGitProperty object itself. + */ + public ConfigServerGitProperty withSearchPaths(List searchPaths) { + this.searchPaths = searchPaths; + return this; + } + + /** + * Get the username property: Username of git repository basic auth. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: Username of git repository basic auth. + * + * @param username the username value to set. + * @return the ConfigServerGitProperty object itself. + */ + public ConfigServerGitProperty withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password property: Password of git repository basic auth. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: Password of git repository basic auth. + * + * @param password the password value to set. + * @return the ConfigServerGitProperty object itself. + */ + public ConfigServerGitProperty withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get the hostKey property: Public sshKey of git repository. + * + * @return the hostKey value. + */ + public String hostKey() { + return this.hostKey; + } + + /** + * Set the hostKey property: Public sshKey of git repository. + * + * @param hostKey the hostKey value to set. + * @return the ConfigServerGitProperty object itself. + */ + public ConfigServerGitProperty withHostKey(String hostKey) { + this.hostKey = hostKey; + return this; + } + + /** + * Get the hostKeyAlgorithm property: SshKey algorithm of git repository. + * + * @return the hostKeyAlgorithm value. + */ + public String hostKeyAlgorithm() { + return this.hostKeyAlgorithm; + } + + /** + * Set the hostKeyAlgorithm property: SshKey algorithm of git repository. + * + * @param hostKeyAlgorithm the hostKeyAlgorithm value to set. + * @return the ConfigServerGitProperty object itself. + */ + public ConfigServerGitProperty withHostKeyAlgorithm(String hostKeyAlgorithm) { + this.hostKeyAlgorithm = hostKeyAlgorithm; + return this; + } + + /** + * Get the privateKey property: Private sshKey algorithm of git repository. + * + * @return the privateKey value. + */ + public String privateKey() { + return this.privateKey; + } + + /** + * Set the privateKey property: Private sshKey algorithm of git repository. + * + * @param privateKey the privateKey value to set. + * @return the ConfigServerGitProperty object itself. + */ + public ConfigServerGitProperty withPrivateKey(String privateKey) { + this.privateKey = privateKey; + return this; + } + + /** + * Get the strictHostKeyChecking property: Strict host key checking or not. + * + * @return the strictHostKeyChecking value. + */ + public Boolean strictHostKeyChecking() { + return this.strictHostKeyChecking; + } + + /** + * Set the strictHostKeyChecking property: Strict host key checking or not. + * + * @param strictHostKeyChecking the strictHostKeyChecking value to set. + * @return the ConfigServerGitProperty object itself. + */ + public ConfigServerGitProperty withStrictHostKeyChecking(Boolean strictHostKeyChecking) { + this.strictHostKeyChecking = strictHostKeyChecking; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (repositories() != null) { + repositories().forEach(e -> e.validate()); + } + if (uri() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property uri in model ConfigServerGitProperty")); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ConfigServerProperties.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ConfigServerProperties.java new file mode 100644 index 000000000000..a44623269ba6 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ConfigServerProperties.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ConfigServerProperties model. */ +@Fluent +public final class ConfigServerProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConfigServerProperties.class); + + /* + * State of the config server. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private ConfigServerState state; + + /* + * Error when apply config server settings. + */ + @JsonProperty(value = "error") + private Error error; + + /* + * Settings of config server. + */ + @JsonProperty(value = "configServer") + private ConfigServerSettings configServer; + + /** + * Get the state property: State of the config server. + * + * @return the state value. + */ + public ConfigServerState state() { + return this.state; + } + + /** + * Get the error property: Error when apply config server settings. + * + * @return the error value. + */ + public Error error() { + return this.error; + } + + /** + * Set the error property: Error when apply config server settings. + * + * @param error the error value to set. + * @return the ConfigServerProperties object itself. + */ + public ConfigServerProperties withError(Error error) { + this.error = error; + return this; + } + + /** + * Get the configServer property: Settings of config server. + * + * @return the configServer value. + */ + public ConfigServerSettings configServer() { + return this.configServer; + } + + /** + * Set the configServer property: Settings of config server. + * + * @param configServer the configServer value to set. + * @return the ConfigServerProperties object itself. + */ + public ConfigServerProperties withConfigServer(ConfigServerSettings configServer) { + this.configServer = configServer; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (error() != null) { + error().validate(); + } + if (configServer() != null) { + configServer().validate(); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ConfigServerSettings.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ConfigServerSettings.java new file mode 100644 index 000000000000..f7d62b02b9ff --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ConfigServerSettings.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ConfigServerSettings model. */ +@Fluent +public final class ConfigServerSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConfigServerSettings.class); + + /* + * Property of git environment. + */ + @JsonProperty(value = "gitProperty") + private ConfigServerGitProperty gitProperty; + + /** + * Get the gitProperty property: Property of git environment. + * + * @return the gitProperty value. + */ + public ConfigServerGitProperty gitProperty() { + return this.gitProperty; + } + + /** + * Set the gitProperty property: Property of git environment. + * + * @param gitProperty the gitProperty value to set. + * @return the ConfigServerSettings object itself. + */ + public ConfigServerSettings withGitProperty(ConfigServerGitProperty gitProperty) { + this.gitProperty = gitProperty; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (gitProperty() != null) { + gitProperty().validate(); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ConfigServerState.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ConfigServerState.java new file mode 100644 index 000000000000..488afab778be --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ConfigServerState.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.appplatform.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ConfigServerState. */ +public final class ConfigServerState extends ExpandableStringEnum { + /** Static value NotAvailable for ConfigServerState. */ + public static final ConfigServerState NOT_AVAILABLE = fromString("NotAvailable"); + + /** Static value Deleted for ConfigServerState. */ + public static final ConfigServerState DELETED = fromString("Deleted"); + + /** Static value Failed for ConfigServerState. */ + public static final ConfigServerState FAILED = fromString("Failed"); + + /** Static value Succeeded for ConfigServerState. */ + public static final ConfigServerState SUCCEEDED = fromString("Succeeded"); + + /** Static value Updating for ConfigServerState. */ + public static final ConfigServerState UPDATING = fromString("Updating"); + + /** + * Creates or finds a ConfigServerState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConfigServerState. + */ + @JsonCreator + public static ConfigServerState fromString(String name) { + return fromString(name, ConfigServerState.class); + } + + /** @return known ConfigServerState values. */ + public static Collection values() { + return values(ConfigServerState.class); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/CustomDomainProperties.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/CustomDomainProperties.java new file mode 100644 index 000000000000..d98b35b605bd --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/CustomDomainProperties.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CustomDomainProperties model. */ +@Fluent +public final class CustomDomainProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomDomainProperties.class); + + /* + * The thumbprint of bound certificate. + */ + @JsonProperty(value = "thumbprint") + private String thumbprint; + + /* + * The app name of domain. + */ + @JsonProperty(value = "appName") + private String appName; + + /* + * The bound certificate name of domain. + */ + @JsonProperty(value = "certName") + private String certName; + + /** + * Get the thumbprint property: The thumbprint of bound certificate. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Set the thumbprint property: The thumbprint of bound certificate. + * + * @param thumbprint the thumbprint value to set. + * @return the CustomDomainProperties object itself. + */ + public CustomDomainProperties withThumbprint(String thumbprint) { + this.thumbprint = thumbprint; + return this; + } + + /** + * Get the appName property: The app name of domain. + * + * @return the appName value. + */ + public String appName() { + return this.appName; + } + + /** + * Set the appName property: The app name of domain. + * + * @param appName the appName value to set. + * @return the CustomDomainProperties object itself. + */ + public CustomDomainProperties withAppName(String appName) { + this.appName = appName; + return this; + } + + /** + * Get the certName property: The bound certificate name of domain. + * + * @return the certName value. + */ + public String certName() { + return this.certName; + } + + /** + * Set the certName property: The bound certificate name of domain. + * + * @param certName the certName value to set. + * @return the CustomDomainProperties object itself. + */ + public CustomDomainProperties withCertName(String certName) { + this.certName = certName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/CustomDomainValidatePayload.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/CustomDomainValidatePayload.java new file mode 100644 index 000000000000..cb3af8d3fe01 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/CustomDomainValidatePayload.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CustomDomainValidatePayload model. */ +@Fluent +public final class CustomDomainValidatePayload { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomDomainValidatePayload.class); + + /* + * Name to be validated + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Get the name property: Name to be validated. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name to be validated. + * + * @param name the name value to set. + * @return the CustomDomainValidatePayload object itself. + */ + public CustomDomainValidatePayload withName(String name) { + this.name = name; + 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 CustomDomainValidatePayload")); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/DeploymentInstance.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/DeploymentInstance.java new file mode 100644 index 000000000000..218634d9ad4a --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/DeploymentInstance.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.appplatform.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The DeploymentInstance model. */ +@Immutable +public final class DeploymentInstance { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeploymentInstance.class); + + /* + * Name of the deployment instance + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Status of the deployment instance + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * Failed reason of the deployment instance + */ + @JsonProperty(value = "reason", access = JsonProperty.Access.WRITE_ONLY) + private String reason; + + /* + * Discovery status of the deployment instance + */ + @JsonProperty(value = "discoveryStatus", access = JsonProperty.Access.WRITE_ONLY) + private String discoveryStatus; + + /** + * Get the name property: Name of the deployment instance. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the status property: Status of the deployment instance. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the reason property: Failed reason of the deployment instance. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Get the discoveryStatus property: Discovery status of the deployment instance. + * + * @return the discoveryStatus value. + */ + public String discoveryStatus() { + return this.discoveryStatus; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/DeploymentResourceProperties.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/DeploymentResourceProperties.java new file mode 100644 index 000000000000..35dd214aab00 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/DeploymentResourceProperties.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The DeploymentResourceProperties model. */ +@Fluent +public final class DeploymentResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeploymentResourceProperties.class); + + /* + * Uploaded source information of the deployment. + */ + @JsonProperty(value = "source") + private UserSourceInfo source; + + /* + * App name of the deployment + */ + @JsonProperty(value = "appName", access = JsonProperty.Access.WRITE_ONLY) + private String appName; + + /* + * Deployment settings of the Deployment + */ + @JsonProperty(value = "deploymentSettings") + private DeploymentSettings deploymentSettings; + + /* + * Provisioning state of the Deployment + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private DeploymentResourceProvisioningState provisioningState; + + /* + * Status of the Deployment + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private DeploymentResourceStatus status; + + /* + * Indicates whether the Deployment is active + */ + @JsonProperty(value = "active", access = JsonProperty.Access.WRITE_ONLY) + private Boolean active; + + /* + * Date time when the resource is created + */ + @JsonProperty(value = "createdTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createdTime; + + /* + * Collection of instances belong to the Deployment + */ + @JsonProperty(value = "instances", access = JsonProperty.Access.WRITE_ONLY) + private List instances; + + /** + * Get the source property: Uploaded source information of the deployment. + * + * @return the source value. + */ + public UserSourceInfo source() { + return this.source; + } + + /** + * Set the source property: Uploaded source information of the deployment. + * + * @param source the source value to set. + * @return the DeploymentResourceProperties object itself. + */ + public DeploymentResourceProperties withSource(UserSourceInfo source) { + this.source = source; + return this; + } + + /** + * Get the appName property: App name of the deployment. + * + * @return the appName value. + */ + public String appName() { + return this.appName; + } + + /** + * Get the deploymentSettings property: Deployment settings of the Deployment. + * + * @return the deploymentSettings value. + */ + public DeploymentSettings deploymentSettings() { + return this.deploymentSettings; + } + + /** + * Set the deploymentSettings property: Deployment settings of the Deployment. + * + * @param deploymentSettings the deploymentSettings value to set. + * @return the DeploymentResourceProperties object itself. + */ + public DeploymentResourceProperties withDeploymentSettings(DeploymentSettings deploymentSettings) { + this.deploymentSettings = deploymentSettings; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the Deployment. + * + * @return the provisioningState value. + */ + public DeploymentResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the status property: Status of the Deployment. + * + * @return the status value. + */ + public DeploymentResourceStatus status() { + return this.status; + } + + /** + * Get the active property: Indicates whether the Deployment is active. + * + * @return the active value. + */ + public Boolean active() { + return this.active; + } + + /** + * Get the createdTime property: Date time when the resource is created. + * + * @return the createdTime value. + */ + public OffsetDateTime createdTime() { + return this.createdTime; + } + + /** + * Get the instances property: Collection of instances belong to the Deployment. + * + * @return the instances value. + */ + public List instances() { + return this.instances; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (source() != null) { + source().validate(); + } + if (deploymentSettings() != null) { + deploymentSettings().validate(); + } + if (instances() != null) { + instances().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/DeploymentResourceProvisioningState.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/DeploymentResourceProvisioningState.java new file mode 100644 index 000000000000..87dab02b2b2c --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/DeploymentResourceProvisioningState.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.appplatform.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DeploymentResourceProvisioningState. */ +public final class DeploymentResourceProvisioningState + extends ExpandableStringEnum { + /** Static value Creating for DeploymentResourceProvisioningState. */ + public static final DeploymentResourceProvisioningState CREATING = fromString("Creating"); + + /** Static value Updating for DeploymentResourceProvisioningState. */ + public static final DeploymentResourceProvisioningState UPDATING = fromString("Updating"); + + /** Static value Succeeded for DeploymentResourceProvisioningState. */ + public static final DeploymentResourceProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for DeploymentResourceProvisioningState. */ + public static final DeploymentResourceProvisioningState FAILED = fromString("Failed"); + + /** + * Creates or finds a DeploymentResourceProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding DeploymentResourceProvisioningState. + */ + @JsonCreator + public static DeploymentResourceProvisioningState fromString(String name) { + return fromString(name, DeploymentResourceProvisioningState.class); + } + + /** @return known DeploymentResourceProvisioningState values. */ + public static Collection values() { + return values(DeploymentResourceProvisioningState.class); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/DeploymentResourceStatus.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/DeploymentResourceStatus.java new file mode 100644 index 000000000000..c171ec186ac9 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/DeploymentResourceStatus.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.appplatform.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DeploymentResourceStatus. */ +public final class DeploymentResourceStatus extends ExpandableStringEnum { + /** Static value Unknown for DeploymentResourceStatus. */ + public static final DeploymentResourceStatus UNKNOWN = fromString("Unknown"); + + /** Static value Stopped for DeploymentResourceStatus. */ + public static final DeploymentResourceStatus STOPPED = fromString("Stopped"); + + /** Static value Running for DeploymentResourceStatus. */ + public static final DeploymentResourceStatus RUNNING = fromString("Running"); + + /** Static value Failed for DeploymentResourceStatus. */ + public static final DeploymentResourceStatus FAILED = fromString("Failed"); + + /** Static value Allocating for DeploymentResourceStatus. */ + public static final DeploymentResourceStatus ALLOCATING = fromString("Allocating"); + + /** Static value Upgrading for DeploymentResourceStatus. */ + public static final DeploymentResourceStatus UPGRADING = fromString("Upgrading"); + + /** Static value Compiling for DeploymentResourceStatus. */ + public static final DeploymentResourceStatus COMPILING = fromString("Compiling"); + + /** + * Creates or finds a DeploymentResourceStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding DeploymentResourceStatus. + */ + @JsonCreator + public static DeploymentResourceStatus fromString(String name) { + return fromString(name, DeploymentResourceStatus.class); + } + + /** @return known DeploymentResourceStatus values. */ + public static Collection values() { + return values(DeploymentResourceStatus.class); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/DeploymentSettings.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/DeploymentSettings.java new file mode 100644 index 000000000000..64293725cfa3 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/DeploymentSettings.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The DeploymentSettings model. */ +@Fluent +public final class DeploymentSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeploymentSettings.class); + + /* + * Required CPU, basic tier should be 1, standard tier should be in range + * (1, 4) + */ + @JsonProperty(value = "cpu") + private Integer cpu; + + /* + * Required Memory size in GB, basic tier should be in range (1, 2), + * standard tier should be in range (1, 8) + */ + @JsonProperty(value = "memoryInGB") + private Integer memoryInGB; + + /* + * JVM parameter + */ + @JsonProperty(value = "jvmOptions") + private String jvmOptions; + + /* + * Instance count, basic tier should be in range (1, 25), standard tier + * should be in range (1, 500) + */ + @JsonProperty(value = "instanceCount") + private Integer instanceCount; + + /* + * Collection of environment variables + */ + @JsonProperty(value = "environmentVariables") + private Map environmentVariables; + + /* + * Runtime version + */ + @JsonProperty(value = "runtimeVersion") + private RuntimeVersion runtimeVersion; + + /** + * Get the cpu property: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). + * + * @return the cpu value. + */ + public Integer cpu() { + return this.cpu; + } + + /** + * Set the cpu property: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). + * + * @param cpu the cpu value to set. + * @return the DeploymentSettings object itself. + */ + public DeploymentSettings withCpu(Integer cpu) { + this.cpu = cpu; + return this; + } + + /** + * Get the memoryInGB property: Required Memory size in GB, basic tier should be in range (1, 2), standard tier + * should be in range (1, 8). + * + * @return the memoryInGB value. + */ + public Integer memoryInGB() { + return this.memoryInGB; + } + + /** + * Set the memoryInGB property: Required Memory size in GB, basic tier should be in range (1, 2), standard tier + * should be in range (1, 8). + * + * @param memoryInGB the memoryInGB value to set. + * @return the DeploymentSettings object itself. + */ + public DeploymentSettings withMemoryInGB(Integer memoryInGB) { + this.memoryInGB = memoryInGB; + return this; + } + + /** + * Get the jvmOptions property: JVM parameter. + * + * @return the jvmOptions value. + */ + public String jvmOptions() { + return this.jvmOptions; + } + + /** + * Set the jvmOptions property: JVM parameter. + * + * @param jvmOptions the jvmOptions value to set. + * @return the DeploymentSettings object itself. + */ + public DeploymentSettings withJvmOptions(String jvmOptions) { + this.jvmOptions = jvmOptions; + return this; + } + + /** + * Get the instanceCount property: Instance count, basic tier should be in range (1, 25), standard tier should be in + * range (1, 500). + * + * @return the instanceCount value. + */ + public Integer instanceCount() { + return this.instanceCount; + } + + /** + * Set the instanceCount property: Instance count, basic tier should be in range (1, 25), standard tier should be in + * range (1, 500). + * + * @param instanceCount the instanceCount value to set. + * @return the DeploymentSettings object itself. + */ + public DeploymentSettings withInstanceCount(Integer instanceCount) { + this.instanceCount = instanceCount; + return this; + } + + /** + * Get the environmentVariables property: Collection of environment variables. + * + * @return the environmentVariables value. + */ + public Map environmentVariables() { + return this.environmentVariables; + } + + /** + * Set the environmentVariables property: Collection of environment variables. + * + * @param environmentVariables the environmentVariables value to set. + * @return the DeploymentSettings object itself. + */ + public DeploymentSettings withEnvironmentVariables(Map environmentVariables) { + this.environmentVariables = environmentVariables; + return this; + } + + /** + * Get the runtimeVersion property: Runtime version. + * + * @return the runtimeVersion value. + */ + public RuntimeVersion runtimeVersion() { + return this.runtimeVersion; + } + + /** + * Set the runtimeVersion property: Runtime version. + * + * @param runtimeVersion the runtimeVersion value to set. + * @return the DeploymentSettings object itself. + */ + public DeploymentSettings withRuntimeVersion(RuntimeVersion runtimeVersion) { + this.runtimeVersion = runtimeVersion; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/Error.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/Error.java new file mode 100644 index 000000000000..658e2cf3bf54 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/Error.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Error model. */ +@Fluent +public final class Error { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Error.class); + + /* + * The code of error. + */ + @JsonProperty(value = "code") + private String code; + + /* + * The message of error. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the code property: The code of error. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: The code of error. + * + * @param code the code value to set. + * @return the Error object itself. + */ + public Error withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message property: The message of error. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: The message of error. + * + * @param message the message value to set. + * @return the Error object itself. + */ + public Error withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/GitPatternRepository.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/GitPatternRepository.java new file mode 100644 index 000000000000..00e9327d2763 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/GitPatternRepository.java @@ -0,0 +1,321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The GitPatternRepository model. */ +@Fluent +public final class GitPatternRepository { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GitPatternRepository.class); + + /* + * Name of the repository + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Collection of pattern of the repository + */ + @JsonProperty(value = "pattern") + private List pattern; + + /* + * URI of the repository + */ + @JsonProperty(value = "uri", required = true) + private String uri; + + /* + * Label of the repository + */ + @JsonProperty(value = "label") + private String label; + + /* + * Searching path of the repository + */ + @JsonProperty(value = "searchPaths") + private List searchPaths; + + /* + * Username of git repository basic auth. + */ + @JsonProperty(value = "username") + private String username; + + /* + * Password of git repository basic auth. + */ + @JsonProperty(value = "password") + private String password; + + /* + * Public sshKey of git repository. + */ + @JsonProperty(value = "hostKey") + private String hostKey; + + /* + * SshKey algorithm of git repository. + */ + @JsonProperty(value = "hostKeyAlgorithm") + private String hostKeyAlgorithm; + + /* + * Private sshKey algorithm of git repository. + */ + @JsonProperty(value = "privateKey") + private String privateKey; + + /* + * Strict host key checking or not. + */ + @JsonProperty(value = "strictHostKeyChecking") + private Boolean strictHostKeyChecking; + + /** + * Get the name property: Name of the repository. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the repository. + * + * @param name the name value to set. + * @return the GitPatternRepository object itself. + */ + public GitPatternRepository withName(String name) { + this.name = name; + return this; + } + + /** + * Get the pattern property: Collection of pattern of the repository. + * + * @return the pattern value. + */ + public List pattern() { + return this.pattern; + } + + /** + * Set the pattern property: Collection of pattern of the repository. + * + * @param pattern the pattern value to set. + * @return the GitPatternRepository object itself. + */ + public GitPatternRepository withPattern(List pattern) { + this.pattern = pattern; + return this; + } + + /** + * Get the uri property: URI of the repository. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: URI of the repository. + * + * @param uri the uri value to set. + * @return the GitPatternRepository object itself. + */ + public GitPatternRepository withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get the label property: Label of the repository. + * + * @return the label value. + */ + public String label() { + return this.label; + } + + /** + * Set the label property: Label of the repository. + * + * @param label the label value to set. + * @return the GitPatternRepository object itself. + */ + public GitPatternRepository withLabel(String label) { + this.label = label; + return this; + } + + /** + * Get the searchPaths property: Searching path of the repository. + * + * @return the searchPaths value. + */ + public List searchPaths() { + return this.searchPaths; + } + + /** + * Set the searchPaths property: Searching path of the repository. + * + * @param searchPaths the searchPaths value to set. + * @return the GitPatternRepository object itself. + */ + public GitPatternRepository withSearchPaths(List searchPaths) { + this.searchPaths = searchPaths; + return this; + } + + /** + * Get the username property: Username of git repository basic auth. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: Username of git repository basic auth. + * + * @param username the username value to set. + * @return the GitPatternRepository object itself. + */ + public GitPatternRepository withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password property: Password of git repository basic auth. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: Password of git repository basic auth. + * + * @param password the password value to set. + * @return the GitPatternRepository object itself. + */ + public GitPatternRepository withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get the hostKey property: Public sshKey of git repository. + * + * @return the hostKey value. + */ + public String hostKey() { + return this.hostKey; + } + + /** + * Set the hostKey property: Public sshKey of git repository. + * + * @param hostKey the hostKey value to set. + * @return the GitPatternRepository object itself. + */ + public GitPatternRepository withHostKey(String hostKey) { + this.hostKey = hostKey; + return this; + } + + /** + * Get the hostKeyAlgorithm property: SshKey algorithm of git repository. + * + * @return the hostKeyAlgorithm value. + */ + public String hostKeyAlgorithm() { + return this.hostKeyAlgorithm; + } + + /** + * Set the hostKeyAlgorithm property: SshKey algorithm of git repository. + * + * @param hostKeyAlgorithm the hostKeyAlgorithm value to set. + * @return the GitPatternRepository object itself. + */ + public GitPatternRepository withHostKeyAlgorithm(String hostKeyAlgorithm) { + this.hostKeyAlgorithm = hostKeyAlgorithm; + return this; + } + + /** + * Get the privateKey property: Private sshKey algorithm of git repository. + * + * @return the privateKey value. + */ + public String privateKey() { + return this.privateKey; + } + + /** + * Set the privateKey property: Private sshKey algorithm of git repository. + * + * @param privateKey the privateKey value to set. + * @return the GitPatternRepository object itself. + */ + public GitPatternRepository withPrivateKey(String privateKey) { + this.privateKey = privateKey; + return this; + } + + /** + * Get the strictHostKeyChecking property: Strict host key checking or not. + * + * @return the strictHostKeyChecking value. + */ + public Boolean strictHostKeyChecking() { + return this.strictHostKeyChecking; + } + + /** + * Set the strictHostKeyChecking property: Strict host key checking or not. + * + * @param strictHostKeyChecking the strictHostKeyChecking value to set. + * @return the GitPatternRepository object itself. + */ + public GitPatternRepository withStrictHostKeyChecking(Boolean strictHostKeyChecking) { + this.strictHostKeyChecking = strictHostKeyChecking; + 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 GitPatternRepository")); + } + if (uri() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property uri in model GitPatternRepository")); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/LogSpecification.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/LogSpecification.java new file mode 100644 index 000000000000..dd3abe662d5f --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/LogSpecification.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The LogSpecification model. */ +@Fluent +public final class LogSpecification { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogSpecification.class); + + /* + * Name of the log + */ + @JsonProperty(value = "name") + private String name; + + /* + * Localized friendly display name of the log + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * Blob duration of the log + */ + @JsonProperty(value = "blobDuration") + private String blobDuration; + + /** + * Get the name property: Name of the log. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the log. + * + * @param name the name value to set. + * @return the LogSpecification object itself. + */ + public LogSpecification withName(String name) { + this.name = name; + return this; + } + + /** + * Get the displayName property: Localized friendly display name of the log. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Localized friendly display name of the log. + * + * @param displayName the displayName value to set. + * @return the LogSpecification object itself. + */ + public LogSpecification withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the blobDuration property: Blob duration of the log. + * + * @return the blobDuration value. + */ + public String blobDuration() { + return this.blobDuration; + } + + /** + * Set the blobDuration property: Blob duration of the log. + * + * @param blobDuration the blobDuration value to set. + * @return the LogSpecification object itself. + */ + public LogSpecification withBlobDuration(String blobDuration) { + this.blobDuration = blobDuration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ManagedIdentityProperties.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ManagedIdentityProperties.java new file mode 100644 index 000000000000..eeaad7f5b410 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ManagedIdentityProperties.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ManagedIdentityProperties model. */ +@Fluent +public final class ManagedIdentityProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedIdentityProperties.class); + + /* + * The type property. + */ + @JsonProperty(value = "type") + private ManagedIdentityType type; + + /* + * The principalId property. + */ + @JsonProperty(value = "principalId") + private String principalId; + + /* + * The tenantId property. + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /** + * Get the type property: The type property. + * + * @return the type value. + */ + public ManagedIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type property. + * + * @param type the type value to set. + * @return the ManagedIdentityProperties object itself. + */ + public ManagedIdentityProperties withType(ManagedIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the principalId property: The principalId property. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Set the principalId property: The principalId property. + * + * @param principalId the principalId value to set. + * @return the ManagedIdentityProperties object itself. + */ + public ManagedIdentityProperties withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get the tenantId property: The tenantId property. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The tenantId property. + * + * @param tenantId the tenantId value to set. + * @return the ManagedIdentityProperties object itself. + */ + public ManagedIdentityProperties withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ManagedIdentityType.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ManagedIdentityType.java new file mode 100644 index 000000000000..5f5f786f44f0 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ManagedIdentityType.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.appplatform.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ManagedIdentityType. */ +public final class ManagedIdentityType extends ExpandableStringEnum { + /** Static value None for ManagedIdentityType. */ + public static final ManagedIdentityType NONE = fromString("None"); + + /** Static value SystemAssigned for ManagedIdentityType. */ + public static final ManagedIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** Static value UserAssigned for ManagedIdentityType. */ + public static final ManagedIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** Static value SystemAssigned,UserAssigned for ManagedIdentityType. */ + public static final ManagedIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED = fromString("SystemAssigned,UserAssigned"); + + /** + * Creates or finds a ManagedIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedIdentityType. + */ + @JsonCreator + public static ManagedIdentityType fromString(String name) { + return fromString(name, ManagedIdentityType.class); + } + + /** @return known ManagedIdentityType values. */ + public static Collection values() { + return values(ManagedIdentityType.class); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/MetricDimension.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/MetricDimension.java new file mode 100644 index 000000000000..efa8babf2616 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/MetricDimension.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The MetricDimension model. */ +@Fluent +public final class MetricDimension { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricDimension.class); + + /* + * Name of the dimension + */ + @JsonProperty(value = "name") + private String name; + + /* + * Localized friendly display name of the dimension + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Get the name property: Name of the dimension. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the dimension. + * + * @param name the name value to set. + * @return the MetricDimension object itself. + */ + public MetricDimension withName(String name) { + this.name = name; + return this; + } + + /** + * Get the displayName property: Localized friendly display name of the dimension. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Localized friendly display name of the dimension. + * + * @param displayName the displayName value to set. + * @return the MetricDimension object itself. + */ + public MetricDimension withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/MetricSpecification.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/MetricSpecification.java new file mode 100644 index 000000000000..c2fe877a1992 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/MetricSpecification.java @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The MetricSpecification model. */ +@Fluent +public final class MetricSpecification { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricSpecification.class); + + /* + * Name of the metric + */ + @JsonProperty(value = "name") + private String name; + + /* + * Localized friendly display name of the metric + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * Localized friendly description of the metric + */ + @JsonProperty(value = "displayDescription") + private String displayDescription; + + /* + * Unit that makes sense for the metric + */ + @JsonProperty(value = "unit") + private String unit; + + /* + * Name of the metric category that the metric belongs to. A metric can + * only belong to a single category. + */ + @JsonProperty(value = "category") + private String category; + + /* + * Only provide one value for this field. Valid values: Average, Minimum, + * Maximum, Total, Count. + */ + @JsonProperty(value = "aggregationType") + private String aggregationType; + + /* + * Supported aggregation types + */ + @JsonProperty(value = "supportedAggregationTypes") + private List supportedAggregationTypes; + + /* + * Supported time grain types + */ + @JsonProperty(value = "supportedTimeGrainTypes") + private List supportedTimeGrainTypes; + + /* + * Optional. If set to true, then zero will be returned for time duration + * where no metric is emitted/published. + */ + @JsonProperty(value = "fillGapWithZero") + private Boolean fillGapWithZero; + + /* + * Dimensions of the metric + */ + @JsonProperty(value = "dimensions") + private List dimensions; + + /** + * Get the name property: Name of the metric. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the metric. + * + * @param name the name value to set. + * @return the MetricSpecification object itself. + */ + public MetricSpecification withName(String name) { + this.name = name; + return this; + } + + /** + * Get the displayName property: Localized friendly display name of the metric. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Localized friendly display name of the metric. + * + * @param displayName the displayName value to set. + * @return the MetricSpecification object itself. + */ + public MetricSpecification withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the displayDescription property: Localized friendly description of the metric. + * + * @return the displayDescription value. + */ + public String displayDescription() { + return this.displayDescription; + } + + /** + * Set the displayDescription property: Localized friendly description of the metric. + * + * @param displayDescription the displayDescription value to set. + * @return the MetricSpecification object itself. + */ + public MetricSpecification withDisplayDescription(String displayDescription) { + this.displayDescription = displayDescription; + return this; + } + + /** + * Get the unit property: Unit that makes sense for the metric. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Set the unit property: Unit that makes sense for the metric. + * + * @param unit the unit value to set. + * @return the MetricSpecification object itself. + */ + public MetricSpecification withUnit(String unit) { + this.unit = unit; + return this; + } + + /** + * Get the category property: Name of the metric category that the metric belongs to. A metric can only belong to a + * single category. + * + * @return the category value. + */ + public String category() { + return this.category; + } + + /** + * Set the category property: Name of the metric category that the metric belongs to. A metric can only belong to a + * single category. + * + * @param category the category value to set. + * @return the MetricSpecification object itself. + */ + public MetricSpecification withCategory(String category) { + this.category = category; + return this; + } + + /** + * Get the aggregationType property: Only provide one value for this field. Valid values: Average, Minimum, Maximum, + * Total, Count. + * + * @return the aggregationType value. + */ + public String aggregationType() { + return this.aggregationType; + } + + /** + * Set the aggregationType property: Only provide one value for this field. Valid values: Average, Minimum, Maximum, + * Total, Count. + * + * @param aggregationType the aggregationType value to set. + * @return the MetricSpecification object itself. + */ + public MetricSpecification withAggregationType(String aggregationType) { + this.aggregationType = aggregationType; + return this; + } + + /** + * Get the supportedAggregationTypes property: Supported aggregation types. + * + * @return the supportedAggregationTypes value. + */ + public List supportedAggregationTypes() { + return this.supportedAggregationTypes; + } + + /** + * Set the supportedAggregationTypes property: Supported aggregation types. + * + * @param supportedAggregationTypes the supportedAggregationTypes value to set. + * @return the MetricSpecification object itself. + */ + public MetricSpecification withSupportedAggregationTypes(List supportedAggregationTypes) { + this.supportedAggregationTypes = supportedAggregationTypes; + return this; + } + + /** + * Get the supportedTimeGrainTypes property: Supported time grain types. + * + * @return the supportedTimeGrainTypes value. + */ + public List supportedTimeGrainTypes() { + return this.supportedTimeGrainTypes; + } + + /** + * Set the supportedTimeGrainTypes property: Supported time grain types. + * + * @param supportedTimeGrainTypes the supportedTimeGrainTypes value to set. + * @return the MetricSpecification object itself. + */ + public MetricSpecification withSupportedTimeGrainTypes(List supportedTimeGrainTypes) { + this.supportedTimeGrainTypes = supportedTimeGrainTypes; + return this; + } + + /** + * Get the fillGapWithZero property: Optional. If set to true, then zero will be returned for time duration where no + * metric is emitted/published. + * + * @return the fillGapWithZero value. + */ + public Boolean fillGapWithZero() { + return this.fillGapWithZero; + } + + /** + * Set the fillGapWithZero property: Optional. If set to true, then zero will be returned for time duration where no + * metric is emitted/published. + * + * @param fillGapWithZero the fillGapWithZero value to set. + * @return the MetricSpecification object itself. + */ + public MetricSpecification withFillGapWithZero(Boolean fillGapWithZero) { + this.fillGapWithZero = fillGapWithZero; + return this; + } + + /** + * Get the dimensions property: Dimensions of the metric. + * + * @return the dimensions value. + */ + public List dimensions() { + return this.dimensions; + } + + /** + * Set the dimensions property: Dimensions of the metric. + * + * @param dimensions the dimensions value to set. + * @return the MetricSpecification object itself. + */ + public MetricSpecification withDimensions(List dimensions) { + this.dimensions = dimensions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dimensions() != null) { + dimensions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/NameAvailabilityParameters.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/NameAvailabilityParameters.java new file mode 100644 index 000000000000..b66eb3e5da15 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/NameAvailabilityParameters.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The NameAvailabilityParameters model. */ +@Fluent +public final class NameAvailabilityParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NameAvailabilityParameters.class); + + /* + * Type of the resource to check name availability + */ + @JsonProperty(value = "type", required = true) + private String type; + + /* + * Name to be checked + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Get the type property: Type of the resource to check name availability. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Type of the resource to check name availability. + * + * @param type the type value to set. + * @return the NameAvailabilityParameters object itself. + */ + public NameAvailabilityParameters withType(String type) { + this.type = type; + return this; + } + + /** + * Get the name property: Name to be checked. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name to be checked. + * + * @param name the name value to set. + * @return the NameAvailabilityParameters object itself. + */ + public NameAvailabilityParameters withName(String name) { + this.name = name; + 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 NameAvailabilityParameters")); + } + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model NameAvailabilityParameters")); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/OperationDisplay.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/OperationDisplay.java new file mode 100644 index 000000000000..3a9e2be984aa --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/OperationDisplay.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The OperationDisplay model. */ +@Fluent +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * Resource provider of the operation + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Resource of the operation + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Localized friendly name for the operation + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Localized friendly description for the operation + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: Resource provider of the operation. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Resource provider of the operation. + * + * @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 of the operation. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Resource of the operation. + * + * @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: Localized friendly name for the operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Localized friendly name for the operation. + * + * @param operation the operation value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Localized friendly description for the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Localized friendly description for the operation. + * + * @param description the description value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/OperationProperties.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/OperationProperties.java new file mode 100644 index 000000000000..fdb26b5bff72 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/OperationProperties.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The OperationProperties model. */ +@Fluent +public final class OperationProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationProperties.class); + + /* + * Service specifications of the operation + */ + @JsonProperty(value = "serviceSpecification") + private ServiceSpecification serviceSpecification; + + /** + * Get the serviceSpecification property: Service specifications of the operation. + * + * @return the serviceSpecification value. + */ + public ServiceSpecification serviceSpecification() { + return this.serviceSpecification; + } + + /** + * Set the serviceSpecification property: Service specifications of the operation. + * + * @param serviceSpecification the serviceSpecification value to set. + * @return the OperationProperties object itself. + */ + public OperationProperties withServiceSpecification(ServiceSpecification serviceSpecification) { + this.serviceSpecification = serviceSpecification; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serviceSpecification() != null) { + serviceSpecification().validate(); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/PersistentDisk.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/PersistentDisk.java new file mode 100644 index 000000000000..58ce442a6a98 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/PersistentDisk.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The PersistentDisk model. */ +@Fluent +public final class PersistentDisk { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PersistentDisk.class); + + /* + * Size of the persistent disk in GB + */ + @JsonProperty(value = "sizeInGB") + private Integer sizeInGB; + + /* + * Size of the used persistent disk in GB + */ + @JsonProperty(value = "usedInGB", access = JsonProperty.Access.WRITE_ONLY) + private Integer usedInGB; + + /* + * Mount path of the persistent disk + */ + @JsonProperty(value = "mountPath") + private String mountPath; + + /** + * Get the sizeInGB property: Size of the persistent disk in GB. + * + * @return the sizeInGB value. + */ + public Integer sizeInGB() { + return this.sizeInGB; + } + + /** + * Set the sizeInGB property: Size of the persistent disk in GB. + * + * @param sizeInGB the sizeInGB value to set. + * @return the PersistentDisk object itself. + */ + public PersistentDisk withSizeInGB(Integer sizeInGB) { + this.sizeInGB = sizeInGB; + return this; + } + + /** + * Get the usedInGB property: Size of the used persistent disk in GB. + * + * @return the usedInGB value. + */ + public Integer usedInGB() { + return this.usedInGB; + } + + /** + * Get the mountPath property: Mount path of the persistent disk. + * + * @return the mountPath value. + */ + public String mountPath() { + return this.mountPath; + } + + /** + * Set the mountPath property: Mount path of the persistent disk. + * + * @param mountPath the mountPath value to set. + * @return the PersistentDisk object itself. + */ + public PersistentDisk withMountPath(String mountPath) { + this.mountPath = mountPath; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ProvisioningState.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ProvisioningState.java new file mode 100644 index 000000000000..b8bf927b282b --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ProvisioningState.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.appplatform.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProvisioningState. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Creating for ProvisioningState. */ + public static final ProvisioningState CREATING = fromString("Creating"); + + /** Static value Updating for ProvisioningState. */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** Static value Deleted for ProvisioningState. */ + public static final ProvisioningState DELETED = fromString("Deleted"); + + /** 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 Moving for ProvisioningState. */ + public static final ProvisioningState MOVING = fromString("Moving"); + + /** Static value Moved for ProvisioningState. */ + public static final ProvisioningState MOVED = fromString("Moved"); + + /** Static value MoveFailed for ProvisioningState. */ + public static final ProvisioningState MOVE_FAILED = fromString("MoveFailed"); + + /** + * 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); + } + + /** @return known ProvisioningState values. */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/RegenerateTestKeyRequestPayload.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/RegenerateTestKeyRequestPayload.java new file mode 100644 index 000000000000..71f8d8c6d2cc --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/RegenerateTestKeyRequestPayload.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The RegenerateTestKeyRequestPayload model. */ +@Fluent +public final class RegenerateTestKeyRequestPayload { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegenerateTestKeyRequestPayload.class); + + /* + * Type of the test key + */ + @JsonProperty(value = "keyType", required = true) + private TestKeyType keyType; + + /** + * Get the keyType property: Type of the test key. + * + * @return the keyType value. + */ + public TestKeyType keyType() { + return this.keyType; + } + + /** + * Set the keyType property: Type of the test key. + * + * @param keyType the keyType value to set. + * @return the RegenerateTestKeyRequestPayload object itself. + */ + public RegenerateTestKeyRequestPayload withKeyType(TestKeyType keyType) { + this.keyType = keyType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (keyType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property keyType in model RegenerateTestKeyRequestPayload")); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceSku.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceSku.java new file mode 100644 index 000000000000..42e32e16d043 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceSku.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The ResourceSku model. */ +@Fluent +public final class ResourceSku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSku.class); + + /* + * Gets the type of resource the SKU applies to. + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /* + * Gets the name of SKU. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Gets the tier of SKU. + */ + @JsonProperty(value = "tier") + private String tier; + + /* + * Gets the capacity of SKU. + */ + @JsonProperty(value = "capacity") + private SkuCapacity capacity; + + /* + * Gets the set of locations that the SKU is available. + */ + @JsonProperty(value = "locations") + private List locations; + + /* + * Gets a list of locations and availability zones in those locations where + * the SKU is available. + */ + @JsonProperty(value = "locationInfo") + private List locationInfo; + + /* + * Gets the restrictions because of which SKU cannot be used. This is + * empty if there are no restrictions. + */ + @JsonProperty(value = "restrictions") + private List restrictions; + + /** + * Get the resourceType property: Gets the type of resource the SKU applies to. + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the resourceType property: Gets the type of resource the SKU applies to. + * + * @param resourceType the resourceType value to set. + * @return the ResourceSku object itself. + */ + public ResourceSku withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get the name property: Gets the name of SKU. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Gets the name of SKU. + * + * @param name the name value to set. + * @return the ResourceSku object itself. + */ + public ResourceSku withName(String name) { + this.name = name; + return this; + } + + /** + * Get the tier property: Gets the tier of SKU. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * Set the tier property: Gets the tier of SKU. + * + * @param tier the tier value to set. + * @return the ResourceSku object itself. + */ + public ResourceSku withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get the capacity property: Gets the capacity of SKU. + * + * @return the capacity value. + */ + public SkuCapacity capacity() { + return this.capacity; + } + + /** + * Set the capacity property: Gets the capacity of SKU. + * + * @param capacity the capacity value to set. + * @return the ResourceSku object itself. + */ + public ResourceSku withCapacity(SkuCapacity capacity) { + this.capacity = capacity; + return this; + } + + /** + * Get the locations property: Gets the set of locations that the SKU is available. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** + * Set the locations property: Gets the set of locations that the SKU is available. + * + * @param locations the locations value to set. + * @return the ResourceSku object itself. + */ + public ResourceSku withLocations(List locations) { + this.locations = locations; + return this; + } + + /** + * Get the locationInfo property: Gets a list of locations and availability zones in those locations where the SKU + * is available. + * + * @return the locationInfo value. + */ + public List locationInfo() { + return this.locationInfo; + } + + /** + * Set the locationInfo property: Gets a list of locations and availability zones in those locations where the SKU + * is available. + * + * @param locationInfo the locationInfo value to set. + * @return the ResourceSku object itself. + */ + public ResourceSku withLocationInfo(List locationInfo) { + this.locationInfo = locationInfo; + return this; + } + + /** + * Get the restrictions property: Gets the restrictions because of which SKU cannot be used. This is empty if there + * are no restrictions. + * + * @return the restrictions value. + */ + public List restrictions() { + return this.restrictions; + } + + /** + * Set the restrictions property: Gets the restrictions because of which SKU cannot be used. This is empty if there + * are no restrictions. + * + * @param restrictions the restrictions value to set. + * @return the ResourceSku object itself. + */ + public ResourceSku withRestrictions(List restrictions) { + this.restrictions = restrictions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (capacity() != null) { + capacity().validate(); + } + if (locationInfo() != null) { + locationInfo().forEach(e -> e.validate()); + } + if (restrictions() != null) { + restrictions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceSkuCapabilities.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceSkuCapabilities.java new file mode 100644 index 000000000000..6db765498a20 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceSkuCapabilities.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ResourceSkuCapabilities model. */ +@Fluent +public final class ResourceSkuCapabilities { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSkuCapabilities.class); + + /* + * Gets an invariant to describe the feature. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Gets an invariant if the feature is measured by quantity. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the name property: Gets an invariant to describe the feature. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Gets an invariant to describe the feature. + * + * @param name the name value to set. + * @return the ResourceSkuCapabilities object itself. + */ + public ResourceSkuCapabilities withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: Gets an invariant if the feature is measured by quantity. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: Gets an invariant if the feature is measured by quantity. + * + * @param value the value value to set. + * @return the ResourceSkuCapabilities object itself. + */ + public ResourceSkuCapabilities 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/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceSkuLocationInfo.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceSkuLocationInfo.java new file mode 100644 index 000000000000..439d9f0afa85 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceSkuLocationInfo.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The ResourceSkuLocationInfo model. */ +@Fluent +public final class ResourceSkuLocationInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSkuLocationInfo.class); + + /* + * Gets location of the SKU + */ + @JsonProperty(value = "location") + private String location; + + /* + * Gets list of availability zones where the SKU is supported. + */ + @JsonProperty(value = "zones") + private List zones; + + /* + * Gets details of capabilities available to a SKU in specific zones. + */ + @JsonProperty(value = "zoneDetails") + private List zoneDetails; + + /** + * Get the location property: Gets location of the SKU. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: Gets location of the SKU. + * + * @param location the location value to set. + * @return the ResourceSkuLocationInfo object itself. + */ + public ResourceSkuLocationInfo withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the zones property: Gets list of availability zones where the SKU is supported. + * + * @return the zones value. + */ + public List zones() { + return this.zones; + } + + /** + * Set the zones property: Gets list of availability zones where the SKU is supported. + * + * @param zones the zones value to set. + * @return the ResourceSkuLocationInfo object itself. + */ + public ResourceSkuLocationInfo withZones(List zones) { + this.zones = zones; + return this; + } + + /** + * Get the zoneDetails property: Gets details of capabilities available to a SKU in specific zones. + * + * @return the zoneDetails value. + */ + public List zoneDetails() { + return this.zoneDetails; + } + + /** + * Set the zoneDetails property: Gets details of capabilities available to a SKU in specific zones. + * + * @param zoneDetails the zoneDetails value to set. + * @return the ResourceSkuLocationInfo object itself. + */ + public ResourceSkuLocationInfo withZoneDetails(List zoneDetails) { + this.zoneDetails = zoneDetails; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (zoneDetails() != null) { + zoneDetails().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceSkuRestrictionInfo.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceSkuRestrictionInfo.java new file mode 100644 index 000000000000..ad66bfad2718 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceSkuRestrictionInfo.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The ResourceSkuRestrictionInfo model. */ +@Fluent +public final class ResourceSkuRestrictionInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSkuRestrictionInfo.class); + + /* + * Gets locations where the SKU is restricted + */ + @JsonProperty(value = "locations") + private List locations; + + /* + * Gets list of availability zones where the SKU is restricted. + */ + @JsonProperty(value = "zones") + private List zones; + + /** + * Get the locations property: Gets locations where the SKU is restricted. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** + * Set the locations property: Gets locations where the SKU is restricted. + * + * @param locations the locations value to set. + * @return the ResourceSkuRestrictionInfo object itself. + */ + public ResourceSkuRestrictionInfo withLocations(List locations) { + this.locations = locations; + return this; + } + + /** + * Get the zones property: Gets list of availability zones where the SKU is restricted. + * + * @return the zones value. + */ + public List zones() { + return this.zones; + } + + /** + * Set the zones property: Gets list of availability zones where the SKU is restricted. + * + * @param zones the zones value to set. + * @return the ResourceSkuRestrictionInfo object itself. + */ + public ResourceSkuRestrictionInfo withZones(List zones) { + this.zones = zones; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceSkuRestrictions.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceSkuRestrictions.java new file mode 100644 index 000000000000..ae843bfe3c65 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceSkuRestrictions.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.resourcemanager.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The ResourceSkuRestrictions model. */ +@Fluent +public final class ResourceSkuRestrictions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSkuRestrictions.class); + + /* + * Gets the type of restrictions. Possible values include: 'Location', + * 'Zone' + */ + @JsonProperty(value = "type") + private ResourceSkuRestrictionsType type; + + /* + * Gets the value of restrictions. If the restriction type is set to + * location. This would be different locations where the SKU is restricted. + */ + @JsonProperty(value = "values") + private List values; + + /* + * Gets the information about the restriction where the SKU cannot be used. + */ + @JsonProperty(value = "restrictionInfo") + private ResourceSkuRestrictionInfo restrictionInfo; + + /* + * Gets the reason for restriction. Possible values include: 'QuotaId', + * 'NotAvailableForSubscription' + */ + @JsonProperty(value = "reasonCode") + private ResourceSkuRestrictionsReasonCode reasonCode; + + /** + * Get the type property: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + * + * @return the type value. + */ + public ResourceSkuRestrictionsType type() { + return this.type; + } + + /** + * Set the type property: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + * + * @param type the type value to set. + * @return the ResourceSkuRestrictions object itself. + */ + public ResourceSkuRestrictions withType(ResourceSkuRestrictionsType type) { + this.type = type; + return this; + } + + /** + * Get the values property: Gets the value of restrictions. If the restriction type is set to location. This would + * be different locations where the SKU is restricted. + * + * @return the values value. + */ + public List values() { + return this.values; + } + + /** + * Set the values property: Gets the value of restrictions. If the restriction type is set to location. This would + * be different locations where the SKU is restricted. + * + * @param values the values value to set. + * @return the ResourceSkuRestrictions object itself. + */ + public ResourceSkuRestrictions withValues(List values) { + this.values = values; + return this; + } + + /** + * Get the restrictionInfo property: Gets the information about the restriction where the SKU cannot be used. + * + * @return the restrictionInfo value. + */ + public ResourceSkuRestrictionInfo restrictionInfo() { + return this.restrictionInfo; + } + + /** + * Set the restrictionInfo property: Gets the information about the restriction where the SKU cannot be used. + * + * @param restrictionInfo the restrictionInfo value to set. + * @return the ResourceSkuRestrictions object itself. + */ + public ResourceSkuRestrictions withRestrictionInfo(ResourceSkuRestrictionInfo restrictionInfo) { + this.restrictionInfo = restrictionInfo; + return this; + } + + /** + * Get the reasonCode property: Gets the reason for restriction. Possible values include: 'QuotaId', + * 'NotAvailableForSubscription'. + * + * @return the reasonCode value. + */ + public ResourceSkuRestrictionsReasonCode reasonCode() { + return this.reasonCode; + } + + /** + * Set the reasonCode property: Gets the reason for restriction. Possible values include: 'QuotaId', + * 'NotAvailableForSubscription'. + * + * @param reasonCode the reasonCode value to set. + * @return the ResourceSkuRestrictions object itself. + */ + public ResourceSkuRestrictions withReasonCode(ResourceSkuRestrictionsReasonCode reasonCode) { + this.reasonCode = reasonCode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (restrictionInfo() != null) { + restrictionInfo().validate(); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceSkuRestrictionsReasonCode.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceSkuRestrictionsReasonCode.java new file mode 100644 index 000000000000..6b2bc15da8cb --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceSkuRestrictionsReasonCode.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.appplatform.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ResourceSkuRestrictionsReasonCode. */ +public final class ResourceSkuRestrictionsReasonCode extends ExpandableStringEnum { + /** Static value QuotaId for ResourceSkuRestrictionsReasonCode. */ + public static final ResourceSkuRestrictionsReasonCode QUOTA_ID = fromString("QuotaId"); + + /** Static value NotAvailableForSubscription for ResourceSkuRestrictionsReasonCode. */ + public static final ResourceSkuRestrictionsReasonCode NOT_AVAILABLE_FOR_SUBSCRIPTION = + fromString("NotAvailableForSubscription"); + + /** + * Creates or finds a ResourceSkuRestrictionsReasonCode from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceSkuRestrictionsReasonCode. + */ + @JsonCreator + public static ResourceSkuRestrictionsReasonCode fromString(String name) { + return fromString(name, ResourceSkuRestrictionsReasonCode.class); + } + + /** @return known ResourceSkuRestrictionsReasonCode values. */ + public static Collection values() { + return values(ResourceSkuRestrictionsReasonCode.class); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceSkuRestrictionsType.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceSkuRestrictionsType.java new file mode 100644 index 000000000000..bd8bbf9208a1 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceSkuRestrictionsType.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.appplatform.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ResourceSkuRestrictionsType. */ +public final class ResourceSkuRestrictionsType extends ExpandableStringEnum { + /** Static value Location for ResourceSkuRestrictionsType. */ + public static final ResourceSkuRestrictionsType LOCATION = fromString("Location"); + + /** Static value Zone for ResourceSkuRestrictionsType. */ + public static final ResourceSkuRestrictionsType ZONE = fromString("Zone"); + + /** + * Creates or finds a ResourceSkuRestrictionsType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceSkuRestrictionsType. + */ + @JsonCreator + public static ResourceSkuRestrictionsType fromString(String name) { + return fromString(name, ResourceSkuRestrictionsType.class); + } + + /** @return known ResourceSkuRestrictionsType values. */ + public static Collection values() { + return values(ResourceSkuRestrictionsType.class); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceSkuZoneDetails.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceSkuZoneDetails.java new file mode 100644 index 000000000000..8b7e417fb214 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceSkuZoneDetails.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The ResourceSkuZoneDetails model. */ +@Fluent +public final class ResourceSkuZoneDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSkuZoneDetails.class); + + /* + * Gets the set of zones that the SKU is available in with the + * specified capabilities. + */ + @JsonProperty(value = "name") + private List name; + + /* + * Gets a list of capabilities that are available for the SKU in the + * specified list of zones. + */ + @JsonProperty(value = "capabilities") + private List capabilities; + + /** + * Get the name property: Gets the set of zones that the SKU is available in with the specified capabilities. + * + * @return the name value. + */ + public List name() { + return this.name; + } + + /** + * Set the name property: Gets the set of zones that the SKU is available in with the specified capabilities. + * + * @param name the name value to set. + * @return the ResourceSkuZoneDetails object itself. + */ + public ResourceSkuZoneDetails withName(List name) { + this.name = name; + return this; + } + + /** + * Get the capabilities property: Gets a list of capabilities that are available for the SKU in the specified list + * of zones. + * + * @return the capabilities value. + */ + public List capabilities() { + return this.capabilities; + } + + /** + * Set the capabilities property: Gets a list of capabilities that are available for the SKU in the specified list + * of zones. + * + * @param capabilities the capabilities value to set. + * @return the ResourceSkuZoneDetails object itself. + */ + public ResourceSkuZoneDetails withCapabilities(List capabilities) { + this.capabilities = capabilities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (capabilities() != null) { + capabilities().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceUploadDefinition.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceUploadDefinition.java new file mode 100644 index 000000000000..5b3202dbe0a1 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ResourceUploadDefinition.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ResourceUploadDefinition model. */ +@Fluent +public final class ResourceUploadDefinition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceUploadDefinition.class); + + /* + * Source relative path + */ + @JsonProperty(value = "relativePath") + private String relativePath; + + /* + * Upload URL + */ + @JsonProperty(value = "uploadUrl") + private String uploadUrl; + + /** + * Get the relativePath property: Source relative path. + * + * @return the relativePath value. + */ + public String relativePath() { + return this.relativePath; + } + + /** + * Set the relativePath property: Source relative path. + * + * @param relativePath the relativePath value to set. + * @return the ResourceUploadDefinition object itself. + */ + public ResourceUploadDefinition withRelativePath(String relativePath) { + this.relativePath = relativePath; + return this; + } + + /** + * Get the uploadUrl property: Upload URL. + * + * @return the uploadUrl value. + */ + public String uploadUrl() { + return this.uploadUrl; + } + + /** + * Set the uploadUrl property: Upload URL. + * + * @param uploadUrl the uploadUrl value to set. + * @return the ResourceUploadDefinition object itself. + */ + public ResourceUploadDefinition withUploadUrl(String uploadUrl) { + this.uploadUrl = uploadUrl; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/RuntimeVersion.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/RuntimeVersion.java new file mode 100644 index 000000000000..389b259eb9f5 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/RuntimeVersion.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.appplatform.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RuntimeVersion. */ +public final class RuntimeVersion extends ExpandableStringEnum { + /** Static value Java_8 for RuntimeVersion. */ + public static final RuntimeVersion JAVA_8 = fromString("Java_8"); + + /** Static value Java_11 for RuntimeVersion. */ + public static final RuntimeVersion JAVA_11 = fromString("Java_11"); + + /** + * Creates or finds a RuntimeVersion from its string representation. + * + * @param name a name to look for. + * @return the corresponding RuntimeVersion. + */ + @JsonCreator + public static RuntimeVersion fromString(String name) { + return fromString(name, RuntimeVersion.class); + } + + /** @return known RuntimeVersion values. */ + public static Collection values() { + return values(RuntimeVersion.class); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ServiceSpecification.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ServiceSpecification.java new file mode 100644 index 000000000000..b7e442aee6bf --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/ServiceSpecification.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The ServiceSpecification model. */ +@Fluent +public final class ServiceSpecification { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceSpecification.class); + + /* + * Specifications of the Log for Azure Monitoring + */ + @JsonProperty(value = "logSpecifications") + private List logSpecifications; + + /* + * Specifications of the Metrics for Azure Monitoring + */ + @JsonProperty(value = "metricSpecifications") + private List metricSpecifications; + + /** + * Get the logSpecifications property: Specifications of the Log for Azure Monitoring. + * + * @return the logSpecifications value. + */ + public List logSpecifications() { + return this.logSpecifications; + } + + /** + * Set the logSpecifications property: Specifications of the Log for Azure Monitoring. + * + * @param logSpecifications the logSpecifications value to set. + * @return the ServiceSpecification object itself. + */ + public ServiceSpecification withLogSpecifications(List logSpecifications) { + this.logSpecifications = logSpecifications; + return this; + } + + /** + * Get the metricSpecifications property: Specifications of the Metrics for Azure Monitoring. + * + * @return the metricSpecifications value. + */ + public List metricSpecifications() { + return this.metricSpecifications; + } + + /** + * Set the metricSpecifications property: Specifications of the Metrics for Azure Monitoring. + * + * @param metricSpecifications the metricSpecifications value to set. + * @return the ServiceSpecification object itself. + */ + public ServiceSpecification withMetricSpecifications(List metricSpecifications) { + this.metricSpecifications = metricSpecifications; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (logSpecifications() != null) { + logSpecifications().forEach(e -> e.validate()); + } + if (metricSpecifications() != null) { + metricSpecifications().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/Sku.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/Sku.java new file mode 100644 index 000000000000..4b869c3b0352 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/Sku.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Sku model. */ +@Fluent +public final class Sku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Sku.class); + + /* + * Name of the Sku + */ + @JsonProperty(value = "name") + private String name; + + /* + * Tier of the Sku + */ + @JsonProperty(value = "tier") + private String tier; + + /* + * Current capacity of the target resource + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * Get the name property: Name of the Sku. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the Sku. + * + * @param name the name value to set. + * @return the Sku object itself. + */ + public Sku withName(String name) { + this.name = name; + return this; + } + + /** + * Get the tier property: Tier of the Sku. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * Set the tier property: Tier of the Sku. + * + * @param tier the tier value to set. + * @return the Sku object itself. + */ + public Sku withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get the capacity property: Current capacity of the target resource. + * + * @return the capacity value. + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the capacity property: Current capacity of the target resource. + * + * @param capacity the capacity value to set. + * @return the Sku object itself. + */ + public Sku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/SkuCapacity.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/SkuCapacity.java new file mode 100644 index 000000000000..4240eadd47dc --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/SkuCapacity.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SkuCapacity model. */ +@Fluent +public final class SkuCapacity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SkuCapacity.class); + + /* + * Gets or sets the minimum. + */ + @JsonProperty(value = "minimum", required = true) + private int minimum; + + /* + * Gets or sets the maximum. + */ + @JsonProperty(value = "maximum") + private Integer maximum; + + /* + * Gets or sets the default. + */ + @JsonProperty(value = "default") + private Integer defaultProperty; + + /* + * Gets or sets the type of the scale. + */ + @JsonProperty(value = "scaleType") + private SkuScaleType scaleType; + + /** + * Get the minimum property: Gets or sets the minimum. + * + * @return the minimum value. + */ + public int minimum() { + return this.minimum; + } + + /** + * Set the minimum property: Gets or sets the minimum. + * + * @param minimum the minimum value to set. + * @return the SkuCapacity object itself. + */ + public SkuCapacity withMinimum(int minimum) { + this.minimum = minimum; + return this; + } + + /** + * Get the maximum property: Gets or sets the maximum. + * + * @return the maximum value. + */ + public Integer maximum() { + return this.maximum; + } + + /** + * Set the maximum property: Gets or sets the maximum. + * + * @param maximum the maximum value to set. + * @return the SkuCapacity object itself. + */ + public SkuCapacity withMaximum(Integer maximum) { + this.maximum = maximum; + return this; + } + + /** + * Get the defaultProperty property: Gets or sets the default. + * + * @return the defaultProperty value. + */ + public Integer defaultProperty() { + return this.defaultProperty; + } + + /** + * Set the defaultProperty property: Gets or sets the default. + * + * @param defaultProperty the defaultProperty value to set. + * @return the SkuCapacity object itself. + */ + public SkuCapacity withDefaultProperty(Integer defaultProperty) { + this.defaultProperty = defaultProperty; + return this; + } + + /** + * Get the scaleType property: Gets or sets the type of the scale. + * + * @return the scaleType value. + */ + public SkuScaleType scaleType() { + return this.scaleType; + } + + /** + * Set the scaleType property: Gets or sets the type of the scale. + * + * @param scaleType the scaleType value to set. + * @return the SkuCapacity object itself. + */ + public SkuCapacity withScaleType(SkuScaleType scaleType) { + this.scaleType = scaleType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/SkuScaleType.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/SkuScaleType.java new file mode 100644 index 000000000000..12e659cfe329 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/SkuScaleType.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.appplatform.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SkuScaleType. */ +public final class SkuScaleType extends ExpandableStringEnum { + /** Static value None for SkuScaleType. */ + public static final SkuScaleType NONE = fromString("None"); + + /** Static value Manual for SkuScaleType. */ + public static final SkuScaleType MANUAL = fromString("Manual"); + + /** Static value Automatic for SkuScaleType. */ + public static final SkuScaleType AUTOMATIC = fromString("Automatic"); + + /** + * Creates or finds a SkuScaleType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SkuScaleType. + */ + @JsonCreator + public static SkuScaleType fromString(String name) { + return fromString(name, SkuScaleType.class); + } + + /** @return known SkuScaleType values. */ + public static Collection values() { + return values(SkuScaleType.class); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/SpringApp.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/SpringApp.java new file mode 100644 index 000000000000..a796973d671f --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/SpringApp.java @@ -0,0 +1,261 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.implementation.annotation.Beta; +import com.azure.resourcemanager.appplatform.fluent.inner.AppResourceInner; +import com.azure.resourcemanager.resources.fluentcore.arm.models.ExternalChildResource; +import com.azure.resourcemanager.resources.fluentcore.model.Appliable; +import com.azure.resourcemanager.resources.fluentcore.model.Creatable; +import com.azure.resourcemanager.resources.fluentcore.model.HasInner; +import com.azure.resourcemanager.resources.fluentcore.model.Updatable; +import reactor.core.publisher.Mono; + +import java.io.File; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of an Azure Spring App. */ +@Fluent +@Beta +public interface SpringApp + extends ExternalChildResource, + HasInner, + Updatable { + /** @return whether the app exposes public endpoint */ + boolean isPublic(); + + /** @return whether only https is allowed for the app */ + boolean isHttpsOnly(); + + /** @return the url of the app */ + String url(); + + /** @return the temporary disk of the app */ + TemporaryDisk temporaryDisk(); + + /** @return the persistent disk of the app */ + PersistentDisk persistentDisk(); + + /** @return the identity property of the app */ + ManagedIdentityProperties identity(); + + /** @return the creation time of the app */ + OffsetDateTime createdTime(); + + /** @return the active deployment name */ + String activeDeployment(); + + /** @return the entry point of the spring app deployment */ + SpringAppDeployments deployments(); + + /** @return the blob url to upload deployment */ + Mono getResourceUploadUrlAsync(); + + /** @return the blob url to upload deployment */ + ResourceUploadDefinition getResourceUploadUrl(); + + /** Container interface for all the definitions that need to be implemented. */ + interface Definition + extends DefinitionStages.Blank { } + + /** Grouping of all the spring app definition stages. */ + interface DefinitionStages { + /** The first stage of the spring app definition. */ + interface Blank extends WithCreate { } + + /** The stage of a spring app definition allowing to specify the endpoint. */ + interface WithEndpoint { + /** + * Enables the public endpoint for the spring app. + * @return the next stage of spring app definition + */ + WithCreate withPublicEndpoint(); + + /** + * Specifies the custom domain for the spring app. + * @param domain the domain name + * @return the next stage of spring app definition + */ + WithCreate withCustomDomain(String domain); + + /** + * Enables https only for the spring app. + * @return the next stage of spring app definition + */ + WithCreate withHttpsOnly(); + } + + /** The stage of a spring app definition allowing to specify the disk. */ + interface WithDisk { + /** + * Specifies the temporary disk for the spring app. + * @param sizeInGB the size of the disk + * @param mountPath the mount path of the disk + * @return the next stage of spring app definition + */ + WithCreate withTemporaryDisk(int sizeInGB, String mountPath); + + /** + * Specifies the persistent disk for the spring app. + * @param sizeInGB the size of the disk + * @param mountPath the mount path of the disk + * @return the next stage of spring app definition + */ + WithCreate withPersistentDisk(int sizeInGB, String mountPath); + } + + /** + * The stage of a spring app definition allowing to specify an simple active deployment. + * for more operations, use {@link #deployments()} + */ + interface WithDeployment { + /** + * Deploys the jar package for the spring app with default scale. + * @param name the name of the deployment + * @param jarFile the file of the jar + * @return the next stage of spring app definition + */ + WithCreate deployJar(String name, File jarFile); + + /** + * Deploys the source code for the spring app with default scale. + * @param name the name of the deployment + * @param sourceCodeFolder the source code folder + * @param targetModule the target module of the source code + * @return the next stage of spring app definition + */ + WithCreate deploySource(String name, File sourceCodeFolder, String targetModule); + } + + /** + * The stage of the definition which contains all the minimum required inputs for the resource to be created, + * but also allows for any other optional settings to be specified. + */ + interface WithCreate + extends Creatable, + DefinitionStages.WithEndpoint, + DefinitionStages.WithDisk, + DefinitionStages.WithDeployment { } + } + + /** The template for an update operation, containing all the settings that can be modified. */ + interface Update + extends Appliable, + UpdateStages.WithEndpoint, + UpdateStages.WithDisk, + UpdateStages.WithDeployment { } + + /** Grouping of spring app update stages. */ + interface UpdateStages { + /** The stage of a spring app update allowing to specify the endpoint. */ + interface WithEndpoint { + /** + * Enables the public endpoint for the spring app. + * @return the next stage of spring app update + */ + Update withPublicEndpoint(); + + /** + * Disables the public endpoint for the spring app. + * @return the next stage of spring app update + */ + Update withoutPublicEndpoint(); + + /** + * Specifies the custom domain for the spring app. + * @param domain the domain name + * @return the next stage of spring app update + */ + Update withCustomDomain(String domain); + + /** + * Removes the custom domain for the spring app. + * @return the next stage of spring app update + */ + Update withoutCustomDomain(); + + /** + * Enables https only for the spring app. + * @return the next stage of spring app update + */ + Update withHttpsOnly(); + + /** + * Disables https only for the spring app. + * @return the next stage of spring app update + */ + Update withoutHttpsOnly(); + } + + /** The stage of a spring app update allowing to specify the disk. */ + interface WithDisk { + /** + * Specifies the temporary disk for the spring app. + * @param sizeInGB the size of the disk + * @param mountPath the mount path of the disk + * @return the next stage of spring app update + */ + Update withTemporaryDisk(int sizeInGB, String mountPath); + + /** + * Removes the temporary disk for the spring app. + * @return the next stage of spring app update + */ + Update withoutTemporaryDisk(); + + /** + * Specifies the persistent disk for the spring app. + * @param sizeInGB the size of the disk + * @param mountPath the mount path of the disk + * @return the next stage of spring app update + */ + Update withPersistentDisk(int sizeInGB, String mountPath); + + /** + * Removes the persistent disk for the spring app. + * @return the next stage of spring app update + */ + Update withoutPersistentDisk(); + } + + + /** + * The stage of a spring app update allowing to specify an simple active deployment. + * for more operations, use {@link #deployments()} + */ + interface WithDeployment { + /** + * Deploys the jar package for the spring app with default scale. + * @param name the name of the deployment + * @param jarFile the file of the jar + * @return the next stage of spring app update + */ + Update deployJar(String name, File jarFile); + + /** + * Deploys the source code for the spring app with default scale. + * @param name the name of the deployment + * @param sourceCodeFolder the source code folder + * @param targetModule the target module of the source code + * @return the next stage of spring app update + */ + Update deploySource(String name, File sourceCodeFolder, String targetModule); + + /** + * Specifies active deployment for the spring app. + * @param name the name of the deployment + * @return the next stage of spring app update + */ + Update withActiveDeployment(String name); + + /** + * Removes a deployment for the spring app. + * @param name the name of the deployment + * @return the next stage of spring app update + */ + Update withoutDeployment(String name); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/SpringAppDeployment.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/SpringAppDeployment.java new file mode 100644 index 000000000000..1c4f1d368803 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/SpringAppDeployment.java @@ -0,0 +1,354 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.implementation.annotation.Beta; +import com.azure.resourcemanager.appplatform.fluent.inner.DeploymentResourceInner; +import com.azure.resourcemanager.resources.fluentcore.arm.models.ExternalChildResource; +import com.azure.resourcemanager.resources.fluentcore.model.Appliable; +import com.azure.resourcemanager.resources.fluentcore.model.Creatable; +import com.azure.resourcemanager.resources.fluentcore.model.HasInner; +import com.azure.resourcemanager.resources.fluentcore.model.Updatable; +import reactor.core.publisher.Mono; + +import java.io.File; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of an Azure deployment Deployment request. */ +@Fluent +@Beta +public interface SpringAppDeployment + extends ExternalChildResource, + HasInner, + Updatable { + /** @return the app name of the deployment */ + String appName(); + + /** @return the deploy settings of the deployment */ + DeploymentSettings settings(); + + /** @return the status of the deployment */ + DeploymentResourceStatus status(); + + /** @return whether the deployment is active */ + boolean isActive(); + + /** @return the creation time of the deployment */ + OffsetDateTime createdTime(); + + /** @return all the instances of the deployment */ + List instances(); + + /** @return the log file url of the deployment */ + String getLogFileUrl(); + + /** @return the log file url of the deployment */ + Mono getLogFileUrlAsync(); + + /** Container interface for all the definitions that need to be implemented. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithSource, + DefinitionStages.WithModule, + DefinitionStages.WithPredefinedSettings, + DefinitionStages.WithSettingsAndCreate { } + + /** Grouping of all the deployment definition stages. */ + interface DefinitionStages { + /** The first stage of the deployment definition. */ + interface Blank extends WithSource { } + + /** The stage of a deployment definition allowing to specify the source code or package. */ + interface WithSource { + /** + * Specifies the jar package for the deployment. + * @param jar the file of the jar + * @return the next stage of deployment definition + */ + WithPredefinedSettings withJarFile(File jar); + + /** + * Specifies the source code for the deployment. + * @param sourceCodeFolder the folder of the source code + * @return the next stage of deployment definition + */ + WithModule withSourceCodeFolder(File sourceCodeFolder); + + /** + * Specifies the source code for the deployment. + * @param sourceCodeTarGz a tar.gz file of the source code + * @return the next stage of deployment definition + */ + WithModule withSourceCodeTarGzFile(File sourceCodeTarGz); + + /** + * Specifies the a existing source in the cloud storage. + * @param type the source type in previous upload + * @param relativePath the relative path gotten from getResourceUploadUrl + * @return the next stage of deployment definition + */ + WithPredefinedSettings withExistingSource(UserSourceType type, String relativePath); + } + + /** The stage of a deployment definition allowing to specify the module of the source code. */ + interface WithModule { + /** + * Specifies the module of the source code. + * @param moduleName the target module of the multi-module source code + * @return the next stage of deployment definition + */ + WithPredefinedSettings withTargetModule(String moduleName); + + /** + * Specifies the only module of the source code. + * @return the next stage of deployment definition + */ + WithPredefinedSettings withSingleModule(); + } + + /** The stage of a deployment definition allowing to specify predefined settings. */ + interface WithPredefinedSettings { + /** + * Specifies the settings from the app active deployment. + * @return the next stage of deployment definition + */ + WithCreate withSettingsFromActiveDeployment(); + + /** + * Specifies the settings from another deployment. + * @param deployment the deployment object + * @return the next stage of deployment definition + */ + WithCreate withSettingsFromDeployment(SpringAppDeployment deployment); + + /** + * Specifies the settings from another deployment. + * @param deploymentName the name of the deployment + * @return the next stage of deployment definition + */ + WithCreate withSettingsFromDeployment(String deploymentName); + + /** + * Customizes settings of the deployment. + * @return the next stage of deployment definition + */ + WithSettingsAndCreate withCustomSetting(); + } + + /** The stage of a deployment definition allowing to specify deployment settings. */ + interface WithSettings { + /** + * Specifies the instance number of the deployment. + * @param count the number of the instance + * @return the next stage of deployment definition + */ + WithSettingsAndCreate withInstance(int count); + + /** + * Specifies the cpu number of the deployment. + * @param cpuCount the number of the cpu + * @return the next stage of deployment definition + */ + WithSettingsAndCreate withCpu(int cpuCount); + + /** + * Specifies the memory of the deployment. + * @param sizeInGB the size of the memory in GB + * @return the next stage of deployment definition + */ + WithSettingsAndCreate withMemory(int sizeInGB); + + /** + * Specifies the runtime version of the deployment. + * @param version the runtime version of Java + * @return the next stage of deployment definition + */ + WithSettingsAndCreate withRuntime(RuntimeVersion version); + + /** + * Specifies the jvm options of the deployment. + * @param jvmOptions the argument of jvm + * @return the next stage of deployment definition + */ + WithSettingsAndCreate withJvmOptions(String jvmOptions); + + /** + * Specifies a environment variable of the deployment. + * @param key the key of the environment + * @param value the value of the environment + * @return the next stage of deployment definition + */ + WithSettingsAndCreate withEnvironment(String key, String value); + + /** + * Specifies the version of the deployment. + * @param versionName the version name of the deployment + * @return the next stage of deployment definition + */ + WithSettingsAndCreate withVersionName(String versionName); + + /** + * Activates of the deployment after definition. + * @return the next stage of deployment definition + */ + WithSettingsAndCreate withActivation(); + } + + interface WithBaseSettings { + /** + * Specifies the version of the deployment. + * @param versionName the version name of the deployment + * @return the next stage of deployment definition + */ + WithCreate withVersionName(String versionName); + + /** + * Activates of the deployment after definition. + * @return the next stage of deployment definition + */ + WithCreate withActivation(); + } + + /** + * The stage of the definition which contains all required inputs for the resource to be created. + */ + interface WithCreate + extends Creatable, + WithBaseSettings { } + + /** + * The stage of the definition which contains all the minimum required inputs for the resource to be created, + * but also allows for any other optional settings to be specified. + */ + interface WithSettingsAndCreate + extends WithCreate, + WithSettings { } + } + + /** The template for an update operation, containing all the settings that can be modified. */ + interface Update + extends Appliable, + UpdateStages.WithSource, + UpdateStages.WithModule, + UpdateStages.WithSettings { } + + /** Grouping of deployment update stages. */ + interface UpdateStages { + /** The stage of a deployment update allowing to specify deployment settings. */ + interface WithSettings { + /** + * Specifies the instance number of the deployment. + * @param count the number of the instance + * @return the next stage of deployment update + */ + Update withInstance(int count); + + /** + * Specifies the cpu number of the deployment. + * @param cpuCount the number of the cpu + * @return the next stage of deployment update + */ + Update withCpu(int cpuCount); + + /** + * Specifies the memory of the deployment. + * @param sizeInGB the size of the memory in GB + * @return the next stage of deployment update + */ + Update withMemory(int sizeInGB); + + /** + * Specifies the runtime version of the deployment. + * @param version the runtime version of Java + * @return the next stage of deployment update + */ + Update withRuntime(RuntimeVersion version); + + /** + * Specifies the jvm options of the deployment. + * @param jvmOptions the argument of jvm + * @return the next stage of deployment update + */ + Update withJvmOptions(String jvmOptions); + + /** + * Specifies a environment variable of the deployment. + * @param key the key of the environment + * @param value the value of the environment + * @return the next stage of deployment update + */ + Update withEnvironment(String key, String value); + + /** + * Removes a environment variable of the deployment. + * @param key the key of the environment + * @return the next stage of deployment update + */ + Update withoutEnvironment(String key); + + /** + * Specifies the version of the deployment. + * @param versionName the version name of the deployment + * @return the next stage of deployment update + */ + Update withVersionName(String versionName); + + /** + * Activates of the deployment after update. + * @return the next stage of deployment update + */ + Update withActivation(); + } + + /** The stage of a deployment update allowing to specify the source code or package. */ + interface WithSource { + /** + * Specifies the jar package for the deployment. + * @param jar the file of the jar + * @return the next stage of deployment update + */ + Update withJarFile(File jar); + + /** + * Specifies the source code for the deployment. + * @param sourceCodeFolder the folder of the source code + * @return the next stage of deployment update + */ + WithModule withSourceCodeFolder(File sourceCodeFolder); + + /** + * Specifies the source code for the deployment. + * @param sourceCodeTarGz a tar.gz file of the source code + * @return the next stage of deployment update + */ + WithModule withSourceCodeTarGzFile(File sourceCodeTarGz); + + /** + * Specifies the a existing source in the cloud storage. + * @param type the source type in previous upload + * @param relativePath the relative path gotten from getResourceUploadUrl + * @return the next stage of deployment update + */ + Update withExistingSource(UserSourceType type, String relativePath); + } + + /** The stage of a deployment update allowing to specify the module of the source code. */ + interface WithModule { + /** + * Specifies the module of the source code. + * @param moduleName the target module of the multi-module source code + * @return the next stage of deployment update + */ + Update withTargetModule(String moduleName); + + /** + * Specifies the only module of the source code. + * @return the next stage of deployment update + */ + Update withSingleModule(); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/SpringAppDeployments.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/SpringAppDeployments.java new file mode 100644 index 000000000000..94b05124a722 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/SpringAppDeployments.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.implementation.annotation.Beta; +import com.azure.resourcemanager.appplatform.AppPlatformManager; +import com.azure.resourcemanager.appplatform.fluent.DeploymentsClient; +import com.azure.resourcemanager.resources.fluentcore.arm.collection.SupportsGettingById; +import com.azure.resourcemanager.resources.fluentcore.arm.collection.SupportsGettingByName; +import com.azure.resourcemanager.resources.fluentcore.arm.models.HasManager; +import com.azure.resourcemanager.resources.fluentcore.arm.models.HasParent; +import com.azure.resourcemanager.resources.fluentcore.collection.SupportsCreating; +import com.azure.resourcemanager.resources.fluentcore.collection.SupportsDeletingById; +import com.azure.resourcemanager.resources.fluentcore.collection.SupportsDeletingByName; +import com.azure.resourcemanager.resources.fluentcore.collection.SupportsListing; +import com.azure.resourcemanager.resources.fluentcore.model.HasInner; + +/** Entry point for Spring App Deployments API. */ +@Fluent +@Beta +public interface SpringAppDeployments + extends HasManager, + HasInner, + HasParent, + SupportsCreating, + SupportsGettingById, + SupportsGettingByName, + SupportsListing, + SupportsDeletingById, + SupportsDeletingByName { +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/SpringApps.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/SpringApps.java new file mode 100644 index 000000000000..d2cb8fe70155 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/SpringApps.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.implementation.annotation.Beta; +import com.azure.resourcemanager.appplatform.AppPlatformManager; +import com.azure.resourcemanager.appplatform.fluent.AppsClient; +import com.azure.resourcemanager.resources.fluentcore.arm.collection.SupportsGettingById; +import com.azure.resourcemanager.resources.fluentcore.arm.collection.SupportsGettingByName; +import com.azure.resourcemanager.resources.fluentcore.arm.models.HasManager; +import com.azure.resourcemanager.resources.fluentcore.arm.models.HasParent; +import com.azure.resourcemanager.resources.fluentcore.collection.SupportsCreating; +import com.azure.resourcemanager.resources.fluentcore.collection.SupportsDeletingById; +import com.azure.resourcemanager.resources.fluentcore.collection.SupportsDeletingByName; +import com.azure.resourcemanager.resources.fluentcore.collection.SupportsListing; +import com.azure.resourcemanager.resources.fluentcore.model.HasInner; + +/** Entry point for Spring Apps API. */ +@Fluent +@Beta +public interface SpringApps + extends HasManager, + HasInner, + HasParent, + SupportsCreating, + SupportsGettingById, + SupportsGettingByName, + SupportsListing, + SupportsDeletingById, + SupportsDeletingByName { +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/SpringService.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/SpringService.java new file mode 100644 index 000000000000..6403422be52d --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/SpringService.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.implementation.annotation.Beta; +import com.azure.resourcemanager.appplatform.AppPlatformManager; +import com.azure.resourcemanager.appplatform.fluent.inner.ServiceResourceInner; +import com.azure.resourcemanager.resources.fluentcore.arm.models.GroupableResource; +import com.azure.resourcemanager.resources.fluentcore.arm.models.Resource; +import com.azure.resourcemanager.resources.fluentcore.model.Appliable; +import com.azure.resourcemanager.resources.fluentcore.model.Creatable; +import com.azure.resourcemanager.resources.fluentcore.model.Refreshable; +import com.azure.resourcemanager.resources.fluentcore.model.Updatable; +import reactor.core.publisher.Mono; + +/** An immutable client-side representation of an Azure Spring Service. */ +@Fluent +@Beta +public interface SpringService + extends GroupableResource, + Refreshable, + Updatable { + + /** @return Sku of the service */ + Sku sku(); + + /** @return Trace properties of the service */ + TraceProperties traceProperties(); + + /** @return server properties of the service */ + ConfigServerProperties serverProperties(); + + /** @return the entry point of the spring app */ + SpringApps apps(); + + /** + * Lists test keys for the service. + * @return all test keys + */ + TestKeys listTestKeys(); + + /** + * Lists test keys for the service. + * @return all test keys + */ + Mono listTestKeysAsync(); + + /** + * Regenerates a test key for the Service. + * @param keyType the type of the regenerated key + * @return all test keys + */ + TestKeys regenerateTestKeys(TestKeyType keyType); + + /** + * Regenerates a test key for the Service. + * @param keyType the type of the regenerated key + * @return all test keys + */ + Mono regenerateTestKeysAsync(TestKeyType keyType); + + /** + * Disables the test endpoint for the service. + */ + void disableTestEndpoint(); + + /** + * Disables the test endpoint for the service. + * @return null + */ + Mono disableTestEndpointAsync(); + + /** + * Enables the test endpoint for the service. + * @return all test keys + */ + TestKeys enableTestEndpoint(); + + /** + * Enables the test endpoint for the service. + * @return all test keys + */ + Mono enableTestEndpointAsync(); + + /** Container interface for all the definitions that need to be implemented. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithGroup, + DefinitionStages.WithCreate { } + + /** Grouping of all the spring service definition stages. */ + interface DefinitionStages { + /** The first stage of the spring service definition. */ + interface Blank extends GroupableResource.DefinitionWithRegion { } + + /** The stage of a spring service definition allowing to specify the resource group. */ + interface WithGroup extends GroupableResource.DefinitionStages.WithGroup { } + + /** + * The stage of a spring service definition allowing to specify sku. + * All sku supported could be gotten from {@link SpringServices#listSkus()}. + */ + interface WithSku { + /** + * Specifies the sku of the spring service. + * @param skuName the sku name + * @return the next stage of spring service definition + */ + WithCreate withSku(String skuName); + + /** + * Specifies the sku of the spring service. + * @param skuName the sku name + * @param capacity the capacity for the spring service + * @return the next stage of spring service definition + */ + WithCreate withSku(String skuName, int capacity); + + /** + * Specifies the sku of the spring service. + * @param sku the entire sku object + * @return the next stage of spring service definition + */ + WithCreate withSku(Sku sku); + } + + /** The stage of a spring service definition allowing to specify tracing with app insight. */ + interface WithTracing { + /** + * Specifies tracing property with app insight + * @param appInsightInstrumentationKey the app insight instrumentation key + * @return the next stage of spring service definition + */ + WithCreate withTracing(String appInsightInstrumentationKey); + } + + /** + * The stage of the definition which contains all the minimum required inputs for the resource to be created, + * but also allows for any other optional settings to be specified. + */ + interface WithCreate + extends Creatable, + Resource.DefinitionWithTags, + WithSku, + WithTracing { } + } + + /** The template for an update operation, containing all the settings that can be modified. */ + interface Update + extends Appliable, + Resource.UpdateWithTags, + UpdateStages.WithSku, + UpdateStages.WithTracing, + UpdateStages.WithConfiguration { } + + /** Grouping of spring service update stages. */ + interface UpdateStages { + /** + * The stage of a spring service update allowing to specify sku. + * All sku supported could be gotten from {@link SpringServices#listSkus()}. + */ + interface WithSku { + /** + * Specifies the sku of the spring service. + * @param skuName the sku name + * @return the next stage of spring service update + */ + Update withSku(String skuName); + + /** + * Specifies the sku of the spring service. + * @param skuName the sku name + * @param capacity the capacity for the spring service + * @return the next stage of spring service update + */ + Update withSku(String skuName, int capacity); + + /** + * Specifies the sku of the spring service. + * @param sku the entire sku object + * @return the next stage of spring service update + */ + Update withSku(Sku sku); + } + + /** The stage of a spring service update allowing to specify tracing with app insight. */ + interface WithTracing { + /** + * Specifies tracing property with app insight. + * @param appInsightInstrumentationKey the app insight instrumentation key + * @return the next stage of spring service update + */ + Update withTracing(String appInsightInstrumentationKey); + + /** + * Removes tracing property. + * @return the next stage of spring service update + */ + Update withoutTracing(); + } + + /** The stage of a spring service update allowing to specify the server configuration. */ + interface WithConfiguration { + /** + * Specifies the git repository for the spring service. + * @param uri the uri of the git repository + * @return the next stage of spring service update + */ + Update withGitUri(String uri); + + /** + * Specifies the git repository for the spring service. + * @param uri the uri of the git repository + * @param username the username of the private git repository + * @param password the password of the private git repository + * @return the next stage of spring service update + */ + Update withGitUriAndCredential(String uri, String username, String password); + + /** + * Specifies the git repository for the spring service. + * @param gitConfig the configuration of the git repository + * @return the next stage of spring service update + */ + Update withGitConfig(ConfigServerGitProperty gitConfig); + + /** + * Removes the git configuration. + * @return the next stage of spring service update + */ + Update withoutGitConfig(); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/SpringServices.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/SpringServices.java new file mode 100644 index 000000000000..861f7a4eca58 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/SpringServices.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.implementation.annotation.Beta; +import com.azure.resourcemanager.appplatform.AppPlatformManager; +import com.azure.resourcemanager.appplatform.fluent.ServicesClient; +import com.azure.resourcemanager.resources.fluentcore.arm.collection.SupportsDeletingByResourceGroup; +import com.azure.resourcemanager.resources.fluentcore.arm.collection.SupportsGettingById; +import com.azure.resourcemanager.resources.fluentcore.arm.collection.SupportsGettingByResourceGroup; +import com.azure.resourcemanager.resources.fluentcore.arm.collection.SupportsListingByResourceGroup; +import com.azure.resourcemanager.resources.fluentcore.arm.models.HasManager; +import com.azure.resourcemanager.resources.fluentcore.collection.SupportsCreating; +import com.azure.resourcemanager.resources.fluentcore.collection.SupportsDeletingById; +import com.azure.resourcemanager.resources.fluentcore.collection.SupportsListing; +import com.azure.resourcemanager.resources.fluentcore.model.HasInner; + +/** Entry point for Spring Service management API. */ +@Fluent +@Beta +public interface SpringServices + extends HasManager, + HasInner, + SupportsCreating, + SupportsGettingById, + SupportsGettingByResourceGroup, + SupportsListing, + SupportsListingByResourceGroup, + SupportsDeletingById, + SupportsDeletingByResourceGroup { + /** @return all available sku. */ + PagedIterable listSkus(); + + /** @return all available sku. */ + PagedFlux listSkusAsync(); +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/TemporaryDisk.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/TemporaryDisk.java new file mode 100644 index 000000000000..f40fe05185ce --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/TemporaryDisk.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The TemporaryDisk model. */ +@Fluent +public final class TemporaryDisk { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TemporaryDisk.class); + + /* + * Size of the temporary disk in GB + */ + @JsonProperty(value = "sizeInGB") + private Integer sizeInGB; + + /* + * Mount path of the temporary disk + */ + @JsonProperty(value = "mountPath") + private String mountPath; + + /** + * Get the sizeInGB property: Size of the temporary disk in GB. + * + * @return the sizeInGB value. + */ + public Integer sizeInGB() { + return this.sizeInGB; + } + + /** + * Set the sizeInGB property: Size of the temporary disk in GB. + * + * @param sizeInGB the sizeInGB value to set. + * @return the TemporaryDisk object itself. + */ + public TemporaryDisk withSizeInGB(Integer sizeInGB) { + this.sizeInGB = sizeInGB; + return this; + } + + /** + * Get the mountPath property: Mount path of the temporary disk. + * + * @return the mountPath value. + */ + public String mountPath() { + return this.mountPath; + } + + /** + * Set the mountPath property: Mount path of the temporary disk. + * + * @param mountPath the mountPath value to set. + * @return the TemporaryDisk object itself. + */ + public TemporaryDisk withMountPath(String mountPath) { + this.mountPath = mountPath; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/TestKeyType.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/TestKeyType.java new file mode 100644 index 000000000000..df7eb484d704 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/TestKeyType.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.appplatform.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for TestKeyType. */ +public final class TestKeyType extends ExpandableStringEnum { + /** Static value Primary for TestKeyType. */ + public static final TestKeyType PRIMARY = fromString("Primary"); + + /** Static value Secondary for TestKeyType. */ + public static final TestKeyType SECONDARY = fromString("Secondary"); + + /** + * Creates or finds a TestKeyType from its string representation. + * + * @param name a name to look for. + * @return the corresponding TestKeyType. + */ + @JsonCreator + public static TestKeyType fromString(String name) { + return fromString(name, TestKeyType.class); + } + + /** @return known TestKeyType values. */ + public static Collection values() { + return values(TestKeyType.class); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/TestKeys.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/TestKeys.java new file mode 100644 index 000000000000..b0e1427bcafd --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/TestKeys.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The TestKeys model. */ +@Fluent +public final class TestKeys { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestKeys.class); + + /* + * Primary key + */ + @JsonProperty(value = "primaryKey") + private String primaryKey; + + /* + * Secondary key + */ + @JsonProperty(value = "secondaryKey") + private String secondaryKey; + + /* + * Primary test endpoint + */ + @JsonProperty(value = "primaryTestEndpoint") + private String primaryTestEndpoint; + + /* + * Secondary test endpoint + */ + @JsonProperty(value = "secondaryTestEndpoint") + private String secondaryTestEndpoint; + + /* + * Indicates whether the test endpoint feature enabled or not + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /** + * Get the primaryKey property: Primary key. + * + * @return the primaryKey value. + */ + public String primaryKey() { + return this.primaryKey; + } + + /** + * Set the primaryKey property: Primary key. + * + * @param primaryKey the primaryKey value to set. + * @return the TestKeys object itself. + */ + public TestKeys withPrimaryKey(String primaryKey) { + this.primaryKey = primaryKey; + return this; + } + + /** + * Get the secondaryKey property: Secondary key. + * + * @return the secondaryKey value. + */ + public String secondaryKey() { + return this.secondaryKey; + } + + /** + * Set the secondaryKey property: Secondary key. + * + * @param secondaryKey the secondaryKey value to set. + * @return the TestKeys object itself. + */ + public TestKeys withSecondaryKey(String secondaryKey) { + this.secondaryKey = secondaryKey; + return this; + } + + /** + * Get the primaryTestEndpoint property: Primary test endpoint. + * + * @return the primaryTestEndpoint value. + */ + public String primaryTestEndpoint() { + return this.primaryTestEndpoint; + } + + /** + * Set the primaryTestEndpoint property: Primary test endpoint. + * + * @param primaryTestEndpoint the primaryTestEndpoint value to set. + * @return the TestKeys object itself. + */ + public TestKeys withPrimaryTestEndpoint(String primaryTestEndpoint) { + this.primaryTestEndpoint = primaryTestEndpoint; + return this; + } + + /** + * Get the secondaryTestEndpoint property: Secondary test endpoint. + * + * @return the secondaryTestEndpoint value. + */ + public String secondaryTestEndpoint() { + return this.secondaryTestEndpoint; + } + + /** + * Set the secondaryTestEndpoint property: Secondary test endpoint. + * + * @param secondaryTestEndpoint the secondaryTestEndpoint value to set. + * @return the TestKeys object itself. + */ + public TestKeys withSecondaryTestEndpoint(String secondaryTestEndpoint) { + this.secondaryTestEndpoint = secondaryTestEndpoint; + return this; + } + + /** + * Get the enabled property: Indicates whether the test endpoint feature enabled or not. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Indicates whether the test endpoint feature enabled or not. + * + * @param enabled the enabled value to set. + * @return the TestKeys object itself. + */ + public TestKeys withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/TraceProperties.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/TraceProperties.java new file mode 100644 index 000000000000..ddf58267be24 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/TraceProperties.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The TraceProperties model. */ +@Fluent +public final class TraceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TraceProperties.class); + + /* + * State of the trace proxy. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private TraceProxyState state; + + /* + * Error when apply trace proxy changes. + */ + @JsonProperty(value = "error") + private Error error; + + /* + * Indicates whether enable the tracing functionality + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /* + * Target application insight instrumentation key + */ + @JsonProperty(value = "appInsightInstrumentationKey") + private String appInsightInstrumentationKey; + + /** + * Get the state property: State of the trace proxy. + * + * @return the state value. + */ + public TraceProxyState state() { + return this.state; + } + + /** + * Get the error property: Error when apply trace proxy changes. + * + * @return the error value. + */ + public Error error() { + return this.error; + } + + /** + * Set the error property: Error when apply trace proxy changes. + * + * @param error the error value to set. + * @return the TraceProperties object itself. + */ + public TraceProperties withError(Error error) { + this.error = error; + return this; + } + + /** + * Get the enabled property: Indicates whether enable the tracing functionality. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Indicates whether enable the tracing functionality. + * + * @param enabled the enabled value to set. + * @return the TraceProperties object itself. + */ + public TraceProperties withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the appInsightInstrumentationKey property: Target application insight instrumentation key. + * + * @return the appInsightInstrumentationKey value. + */ + public String appInsightInstrumentationKey() { + return this.appInsightInstrumentationKey; + } + + /** + * Set the appInsightInstrumentationKey property: Target application insight instrumentation key. + * + * @param appInsightInstrumentationKey the appInsightInstrumentationKey value to set. + * @return the TraceProperties object itself. + */ + public TraceProperties withAppInsightInstrumentationKey(String appInsightInstrumentationKey) { + this.appInsightInstrumentationKey = appInsightInstrumentationKey; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (error() != null) { + error().validate(); + } + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/TraceProxyState.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/TraceProxyState.java new file mode 100644 index 000000000000..aa779bc61b1e --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/TraceProxyState.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.appplatform.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for TraceProxyState. */ +public final class TraceProxyState extends ExpandableStringEnum { + /** Static value NotAvailable for TraceProxyState. */ + public static final TraceProxyState NOT_AVAILABLE = fromString("NotAvailable"); + + /** Static value Failed for TraceProxyState. */ + public static final TraceProxyState FAILED = fromString("Failed"); + + /** Static value Succeeded for TraceProxyState. */ + public static final TraceProxyState SUCCEEDED = fromString("Succeeded"); + + /** Static value Updating for TraceProxyState. */ + public static final TraceProxyState UPDATING = fromString("Updating"); + + /** + * Creates or finds a TraceProxyState from its string representation. + * + * @param name a name to look for. + * @return the corresponding TraceProxyState. + */ + @JsonCreator + public static TraceProxyState fromString(String name) { + return fromString(name, TraceProxyState.class); + } + + /** @return known TraceProxyState values. */ + public static Collection values() { + return values(TraceProxyState.class); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/TrackedResource.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/TrackedResource.java new file mode 100644 index 000000000000..2f2cf6bbb5a9 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/TrackedResource.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The TrackedResource model. */ +@Fluent +public class TrackedResource extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TrackedResource.class); + + /* + * The GEO location of the resource. + */ + @JsonProperty(value = "location") + private String location; + + /* + * Tags of the service which is a list of key value pairs that describe the + * resource. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the location property: The GEO location of the resource. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The GEO location of the resource. + * + * @param location the location value to set. + * @return the TrackedResource object itself. + */ + public TrackedResource withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the tags property: Tags of the service which is a list of key value pairs that describe the resource. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Tags of the service which is a list of key value pairs that describe the resource. + * + * @param tags the tags value to set. + * @return the TrackedResource object itself. + */ + public TrackedResource 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/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/UserSourceInfo.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/UserSourceInfo.java new file mode 100644 index 000000000000..e846a1b3cd60 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/UserSourceInfo.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.appplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The UserSourceInfo model. */ +@Fluent +public final class UserSourceInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserSourceInfo.class); + + /* + * Type of the source uploaded + */ + @JsonProperty(value = "type") + private UserSourceType type; + + /* + * Relative path of the storage which stores the source + */ + @JsonProperty(value = "relativePath") + private String relativePath; + + /* + * Version of the source + */ + @JsonProperty(value = "version") + private String version; + + /* + * Selector for the artifact to be used for the deployment for multi-module + * projects. This should be + * the relative path to the target module/project. + */ + @JsonProperty(value = "artifactSelector") + private String artifactSelector; + + /** + * Get the type property: Type of the source uploaded. + * + * @return the type value. + */ + public UserSourceType type() { + return this.type; + } + + /** + * Set the type property: Type of the source uploaded. + * + * @param type the type value to set. + * @return the UserSourceInfo object itself. + */ + public UserSourceInfo withType(UserSourceType type) { + this.type = type; + return this; + } + + /** + * Get the relativePath property: Relative path of the storage which stores the source. + * + * @return the relativePath value. + */ + public String relativePath() { + return this.relativePath; + } + + /** + * Set the relativePath property: Relative path of the storage which stores the source. + * + * @param relativePath the relativePath value to set. + * @return the UserSourceInfo object itself. + */ + public UserSourceInfo withRelativePath(String relativePath) { + this.relativePath = relativePath; + return this; + } + + /** + * Get the version property: Version of the source. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Version of the source. + * + * @param version the version value to set. + * @return the UserSourceInfo object itself. + */ + public UserSourceInfo withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the artifactSelector property: Selector for the artifact to be used for the deployment for multi-module + * projects. This should be the relative path to the target module/project. + * + * @return the artifactSelector value. + */ + public String artifactSelector() { + return this.artifactSelector; + } + + /** + * Set the artifactSelector property: Selector for the artifact to be used for the deployment for multi-module + * projects. This should be the relative path to the target module/project. + * + * @param artifactSelector the artifactSelector value to set. + * @return the UserSourceInfo object itself. + */ + public UserSourceInfo withArtifactSelector(String artifactSelector) { + this.artifactSelector = artifactSelector; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/UserSourceType.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/UserSourceType.java new file mode 100644 index 000000000000..95db47bca077 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/UserSourceType.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.appplatform.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for UserSourceType. */ +public final class UserSourceType extends ExpandableStringEnum { + /** Static value Jar for UserSourceType. */ + public static final UserSourceType JAR = fromString("Jar"); + + /** Static value Source for UserSourceType. */ + public static final UserSourceType SOURCE = fromString("Source"); + + /** + * Creates or finds a UserSourceType from its string representation. + * + * @param name a name to look for. + * @return the corresponding UserSourceType. + */ + @JsonCreator + public static UserSourceType fromString(String name) { + return fromString(name, UserSourceType.class); + } + + /** @return known UserSourceType values. */ + public static Collection values() { + return values(UserSourceType.class); + } +} diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/package-info.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/models/package-info.java new file mode 100644 index 000000000000..12fc4282caf3 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/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 AppPlatformManagementClient. REST API for Azure Spring Cloud. */ +package com.azure.resourcemanager.appplatform.models; diff --git a/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/package-info.java b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/package-info.java new file mode 100644 index 000000000000..d3e4c42ab0c8 --- /dev/null +++ b/sdk/appplatform/mgmt/src/main/java/com/azure/resourcemanager/appplatform/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 AppPlatformManagementClient. REST API for Azure Spring Cloud. */ +package com.azure.resourcemanager.appplatform; diff --git a/sdk/appplatform/mgmt/src/test/java/com/azure/resourcemanager/appplatform/AppPlatformTest.java b/sdk/appplatform/mgmt/src/test/java/com/azure/resourcemanager/appplatform/AppPlatformTest.java new file mode 100644 index 000000000000..2a1f0a14aeb6 --- /dev/null +++ b/sdk/appplatform/mgmt/src/test/java/com/azure/resourcemanager/appplatform/AppPlatformTest.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.appplatform; + +import com.azure.core.http.HttpPipeline; +import com.azure.resourcemanager.resources.core.TestBase; +import com.azure.resourcemanager.resources.fluentcore.profile.AzureProfile; + +import java.io.IOException; + +public class AppPlatformTest extends TestBase { + protected AppPlatformManager appPlatformManager; + protected String rgName = ""; + + public AppPlatformTest() { + } + + AppPlatformTest(RunCondition runCondition) { + super(runCondition); + } + + @Override + protected void initializeClients(HttpPipeline httpPipeline, AzureProfile profile) throws IOException { + rgName = generateRandomResourceName("rg", 20); + appPlatformManager = AppPlatformManager.authenticate(httpPipeline, profile); + } + + @Override + protected void cleanUpResources() { + try { + appPlatformManager.resourceManager().resourceGroups().beginDeleteByName(rgName); + } catch (Exception e) { } + } +} diff --git a/sdk/appplatform/mgmt/src/test/java/com/azure/resourcemanager/appplatform/SpringCloudTest.java b/sdk/appplatform/mgmt/src/test/java/com/azure/resourcemanager/appplatform/SpringCloudTest.java new file mode 100644 index 000000000000..86f1b70b83af --- /dev/null +++ b/sdk/appplatform/mgmt/src/test/java/com/azure/resourcemanager/appplatform/SpringCloudTest.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.appplatform; + +import com.azure.resourcemanager.appplatform.models.RuntimeVersion; +import com.azure.resourcemanager.appplatform.models.SpringApp; +import com.azure.resourcemanager.appplatform.models.SpringAppDeployment; +import com.azure.resourcemanager.appplatform.models.SpringService; +import com.azure.resourcemanager.resources.fluentcore.arm.Region; +import com.azure.resourcemanager.resources.fluentcore.utils.SdkContext; +import org.apache.commons.compress.archivers.tar.TarArchiveEntry; +import org.apache.commons.compress.archivers.tar.TarArchiveInputStream; +import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream; +import org.apache.commons.compress.utils.IOUtils; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.URL; + +public class SpringCloudTest extends AppPlatformTest { + + SpringCloudTest() { + super(RunCondition.LIVE_ONLY); // need storage data-plane and url check + } + + @Test + public void canCRUDSpringAppWithDeployment() throws IOException { + String serviceName = generateRandomResourceName("springsvc", 15); + String appName = "gateway"; + String deploymentName = generateRandomResourceName("deploy", 15); + String deploymentName1 = generateRandomResourceName("deploy", 15); + + SpringService service = appPlatformManager.springServices().define(serviceName) + .withRegion(Region.US_EAST) + .withNewResourceGroup(rgName) + .withSku("B0") + .create(); + + Assertions.assertEquals("B0", service.sku().name()); + + service.update() + .withSku("S0") + .apply(); + + Assertions.assertEquals("S0", service.sku().name()); + + service.update() + .withGitUri("https://github.com/Azure-Samples/piggymetrics-config") + .apply(); + Assertions.assertEquals("https://github.com/Azure-Samples/piggymetrics-config", service.serverProperties().configServer().gitProperty().uri()); + + File jarFile = new File("gateway.jar"); + if (!jarFile.exists()) { + HttpURLConnection connection = (HttpURLConnection) new URL("https://github.com/weidongxu-microsoft/azure-sdk-for-java-management-tests/raw/master/spring-cloud/gateway.jar").openConnection(); + connection.connect(); + try (InputStream inputStream = connection.getInputStream(); + OutputStream outputStream = new FileOutputStream(jarFile)) { + IOUtils.copy(inputStream, outputStream); + } + connection.disconnect(); + } + + SpringApp app = service.apps().define(appName) + .withPublicEndpoint() + .create(); + + Assertions.assertNotNull(app.url()); + Assertions.assertNotNull(app.activeDeployment()); + + Assertions.assertTrue(requestSuccess(app.url())); + + app.update() + .withoutDeployment(app.activeDeployment()) + .deployJar(deploymentName, jarFile) + .apply(); + + Assertions.assertNotNull(app.url()); + Assertions.assertEquals(deploymentName, app.activeDeployment()); + Assertions.assertEquals(1, app.deployments().list().stream().count()); + + Assertions.assertTrue(requestSuccess(app.url())); + + SpringAppDeployment deployment = app.deployments().getByName(app.activeDeployment()); + deployment.update() + .withCpu(2) + .withMemory(4) + .withRuntime(RuntimeVersion.JAVA_11) + .withInstance(2) + .apply(); + + Assertions.assertEquals(2, deployment.settings().cpu()); + Assertions.assertEquals(4, deployment.settings().memoryInGB()); + Assertions.assertEquals(RuntimeVersion.JAVA_11, deployment.settings().runtimeVersion()); + Assertions.assertEquals(2, deployment.instances().size()); + + File sourceCodeFolder = new File("piggymetrics"); + if (!sourceCodeFolder.exists() || sourceCodeFolder.isFile()) { + if (sourceCodeFolder.isFile()) { + sourceCodeFolder.delete(); + } + extraTarGzSource(sourceCodeFolder); + } + + deployment = app.deployments().define(deploymentName1) + .withSourceCodeFolder(sourceCodeFolder) + .withTargetModule("gateway") + .withSettingsFromActiveDeployment() + .withActivation() + .create(); + app.refresh(); + + Assertions.assertEquals(deploymentName1, app.activeDeployment()); + Assertions.assertEquals(2, deployment.settings().cpu()); + Assertions.assertNotNull(deployment.getLogFileUrl()); + + Assertions.assertTrue(requestSuccess(app.url())); + + app.update() + .withoutPublicEndpoint() + .apply(); + Assertions.assertFalse(app.isPublic()); + } + + private boolean requestSuccess(String url) throws IOException { + for (int i = 0; i < 60; ++i) { + HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); + try { + connection.connect(); + if (connection.getResponseCode() == 200) { + connection.getInputStream().close(); + return true; + } + System.out.printf("Do request to %s with response code %d%n", url, connection.getResponseCode()); + } finally { + connection.disconnect(); + SdkContext.sleep(5000); + } + } + return false; + } + + private void extraTarGzSource(File folder) throws IOException { + HttpURLConnection connection = (HttpURLConnection) new URL("https://github.com/weidongxu-microsoft/azure-sdk-for-java-management-tests/raw/master/spring-cloud/piggymetrics.tar.gz").openConnection(); + connection.connect(); + try (TarArchiveInputStream inputStream = new TarArchiveInputStream(new GzipCompressorInputStream(connection.getInputStream()))) { + TarArchiveEntry entry; + while ((entry = inputStream.getNextTarEntry()) != null) { + if (entry.isDirectory()) { + continue; + } + File file = new File(folder, entry.getName()); + File parent = file.getParentFile(); + if (!parent.exists()) { + parent.mkdirs(); + } + try (OutputStream outputStream = new FileOutputStream(file)) { + IOUtils.copy(inputStream, outputStream); + } + } + } + connection.disconnect(); + } +} diff --git a/sdk/appservice/mgmt/src/main/java/com/azure/resourcemanager/appservice/WebSiteManagementClient.java b/sdk/appservice/mgmt/src/main/java/com/azure/resourcemanager/appservice/WebSiteManagementClient.java index cc535c6cd6a4..0381c1d7c68c 100644 --- a/sdk/appservice/mgmt/src/main/java/com/azure/resourcemanager/appservice/WebSiteManagementClient.java +++ b/sdk/appservice/mgmt/src/main/java/com/azure/resourcemanager/appservice/WebSiteManagementClient.java @@ -8,7 +8,7 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.management.AzureEnvironment; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.AzureServiceClient; +import com.azure.resourcemanager.resources.fluentcore.AzureServiceClient; import com.azure.resourcemanager.appservice.fluent.AppServiceCertificateOrdersClient; import com.azure.resourcemanager.appservice.fluent.AppServiceEnvironmentsClient; import com.azure.resourcemanager.appservice.fluent.AppServicePlansClient; diff --git a/sdk/appservice/mgmt/src/main/java/com/azure/resourcemanager/appservice/implementation/KuduClient.java b/sdk/appservice/mgmt/src/main/java/com/azure/resourcemanager/appservice/implementation/KuduClient.java index 4e7f2dd423f7..2f704de4c5d9 100644 --- a/sdk/appservice/mgmt/src/main/java/com/azure/resourcemanager/appservice/implementation/KuduClient.java +++ b/sdk/appservice/mgmt/src/main/java/com/azure/resourcemanager/appservice/implementation/KuduClient.java @@ -24,8 +24,11 @@ import com.azure.resourcemanager.appservice.models.KuduAuthenticationPolicy; import com.azure.resourcemanager.appservice.models.WebAppBase; import com.fasterxml.jackson.core.JsonParseException; + +import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; +import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; @@ -140,7 +143,9 @@ Mono warDeploy( "x-ms-body-logging: false" }) @Post("api/zipdeploy") - Mono zipDeploy(@HostParam("$host") String host, @BodyParam("application/octet-stream") byte[] zipFile); + Mono zipDeploy( + @HostParam("$host") String host, + @BodyParam("application/octet-stream") byte[] zipFile); @Headers({ "Content-Type: application/octet-stream", @@ -243,7 +248,12 @@ private static int findByte(ByteBuffer byteBuffer, byte b) { } Mono warDeployAsync(InputStream warFile, String appName) { - return withRetry(service.warDeploy(host, byteArrayFromInputStream(warFile), appName)); + InputStreamFlux flux = fluxFromInputStream(warFile); + if (flux.flux != null) { + return withRetry(service.warDeploy(host, flux.flux, flux.size, appName)); + } else { + return withRetry(service.warDeploy(host, flux.bytes, appName)); + } } Mono warDeployAsync(File warFile, String appName) throws IOException { @@ -259,7 +269,12 @@ Mono warDeployAsync(File warFile, String appName) throws IOException { } Mono zipDeployAsync(InputStream zipFile) { - return withRetry(service.zipDeploy(host, byteArrayFromInputStream(zipFile))); + InputStreamFlux flux = fluxFromInputStream(zipFile); + if (flux.flux != null) { + return withRetry(service.zipDeploy(host, flux.flux, flux.size)); + } else { + return withRetry(service.zipDeploy(host, flux.bytes)); + } } Mono zipDeployAsync(File zipFile) throws IOException { @@ -274,21 +289,37 @@ Mono zipDeployAsync(File zipFile) throws IOException { })); } - private byte[] byteArrayFromInputStream(InputStream inputStream) { - // TODO (weidxu) core does not yet support InputStream as @BodyParam + private InputStreamFlux fluxFromInputStream(InputStream inputStream) { try { - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - int nRead; - byte[] data = new byte[16384]; - while ((nRead = inputStream.read(data, 0, data.length)) != -1) { - buffer.write(data, 0, nRead); + InputStreamFlux inputStreamFlux = new InputStreamFlux(); + if (inputStream instanceof FileInputStream) { + inputStreamFlux.size = ((FileInputStream) inputStream).getChannel().size(); + inputStreamFlux.flux = FluxUtil.toFluxByteBuffer(inputStream); + } else if (inputStream instanceof ByteArrayInputStream) { + inputStreamFlux.size = inputStream.available(); + inputStreamFlux.flux = FluxUtil.toFluxByteBuffer(inputStream); + } else { + ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + int nRead; + byte[] data = new byte[16384]; + while ((nRead = inputStream.read(data, 0, data.length)) != -1) { + buffer.write(data, 0, nRead); + } + inputStreamFlux.bytes = buffer.toByteArray(); + inputStreamFlux.size = inputStreamFlux.bytes.length; } - return buffer.toByteArray(); + return inputStreamFlux; } catch (IOException e) { throw logger.logExceptionAsError(new IllegalStateException(e)); } } + private static class InputStreamFlux { + private Flux flux; + private byte[] bytes; + private long size; + } + private Mono withRetry(Mono observable) { return observable .retryWhen( diff --git a/sdk/appservice/mgmt/src/test/java/com/azure/resourcemanager/appservice/AppServiceTest.java b/sdk/appservice/mgmt/src/test/java/com/azure/resourcemanager/appservice/AppServiceTest.java index 814bc570538f..a7cfd3991baf 100644 --- a/sdk/appservice/mgmt/src/test/java/com/azure/resourcemanager/appservice/AppServiceTest.java +++ b/sdk/appservice/mgmt/src/test/java/com/azure/resourcemanager/appservice/AppServiceTest.java @@ -34,11 +34,11 @@ import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; -import java.net.URL; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.temporal.ChronoUnit; +import com.azure.resourcemanager.resources.fluentcore.utils.Utils; import org.apache.commons.net.ftp.FTP; import org.apache.commons.net.ftp.FTPClient; import org.junit.jupiter.api.Assertions; @@ -171,7 +171,7 @@ public static void uploadFileToWebApp(PublishingProfile profile, String fileName protected Response curl(String urlString) throws IOException { try { - return stringResponse(httpClient.getString(getHost(urlString), getPathAndQuery(urlString))).block(); + return stringResponse(httpClient.getString(Utils.getHost(urlString), Utils.getPathAndQuery(urlString))).block(); } catch (MalformedURLException e) { Assertions.fail(); return null; @@ -180,7 +180,7 @@ protected Response curl(String urlString) throws IOException { protected String post(String urlString, String body) { try { - return stringResponse(httpClient.postString(getHost(urlString), getPathAndQuery(urlString), body)) + return stringResponse(httpClient.postString(Utils.getHost(urlString), Utils.getPathAndQuery(urlString), body)) .block() .getValue(); } catch (Exception e) { @@ -201,23 +201,6 @@ private static Mono> stringResponse(Mono response = curl("http://" + webappName + "." + "azurewebsites.net"); Assertions.assertEquals(200, response.getStatusCode()); diff --git a/sdk/authorization/mgmt/src/main/java/com/azure/resourcemanager/authorization/AuthorizationManagementClient.java b/sdk/authorization/mgmt/src/main/java/com/azure/resourcemanager/authorization/AuthorizationManagementClient.java index b066d4f1efc7..771fd3941167 100644 --- a/sdk/authorization/mgmt/src/main/java/com/azure/resourcemanager/authorization/AuthorizationManagementClient.java +++ b/sdk/authorization/mgmt/src/main/java/com/azure/resourcemanager/authorization/AuthorizationManagementClient.java @@ -8,7 +8,7 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.management.AzureEnvironment; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.AzureServiceClient; +import com.azure.resourcemanager.resources.fluentcore.AzureServiceClient; import com.azure.resourcemanager.authorization.fluent.ClassicAdministratorsClient; import com.azure.resourcemanager.authorization.fluent.GlobalAdministratorsClient; import com.azure.resourcemanager.authorization.fluent.PermissionsClient; diff --git a/sdk/authorization/mgmt/src/main/java/com/azure/resourcemanager/authorization/GraphRbacManagementClient.java b/sdk/authorization/mgmt/src/main/java/com/azure/resourcemanager/authorization/GraphRbacManagementClient.java index 06134b8541e7..4f970c456d80 100644 --- a/sdk/authorization/mgmt/src/main/java/com/azure/resourcemanager/authorization/GraphRbacManagementClient.java +++ b/sdk/authorization/mgmt/src/main/java/com/azure/resourcemanager/authorization/GraphRbacManagementClient.java @@ -8,7 +8,7 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.management.AzureEnvironment; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.AzureServiceClient; +import com.azure.resourcemanager.resources.fluentcore.AzureServiceClient; import com.azure.resourcemanager.authorization.fluent.ApplicationsClient; import com.azure.resourcemanager.authorization.fluent.DeletedApplicationsClient; import com.azure.resourcemanager.authorization.fluent.DomainsClient; diff --git a/sdk/cognitiveservices/ms-azure-cs-luis-authoring/pom.xml b/sdk/cognitiveservices/ms-azure-cs-luis-authoring/pom.xml index 66234f34ad6b..24e805f28384 100644 --- a/sdk/cognitiveservices/ms-azure-cs-luis-authoring/pom.xml +++ b/sdk/cognitiveservices/ms-azure-cs-luis-authoring/pom.xml @@ -13,7 +13,7 @@ azure-cognitiveservices-luis-authoring com.microsoft.azure.cognitiveservices - 1.0.4-beta + 1.0.5-beta jar Microsoft Azure SDK for Cognitive Service Language Understanding (LUIS) This package contains Microsoft Cognitive Service Language Understanding (LUIS). diff --git a/sdk/compute/mgmt/src/main/java/com/azure/resourcemanager/compute/ComputeManagementClient.java b/sdk/compute/mgmt/src/main/java/com/azure/resourcemanager/compute/ComputeManagementClient.java index 5b16ce322a01..c2c288d7c6fe 100644 --- a/sdk/compute/mgmt/src/main/java/com/azure/resourcemanager/compute/ComputeManagementClient.java +++ b/sdk/compute/mgmt/src/main/java/com/azure/resourcemanager/compute/ComputeManagementClient.java @@ -8,7 +8,7 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.management.AzureEnvironment; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.AzureServiceClient; +import com.azure.resourcemanager.resources.fluentcore.AzureServiceClient; import com.azure.resourcemanager.compute.fluent.AvailabilitySetsClient; import com.azure.resourcemanager.compute.fluent.ContainerServicesClient; import com.azure.resourcemanager.compute.fluent.DedicatedHostGroupsClient; diff --git a/sdk/containerregistry/mgmt/src/main/java/com/azure/resourcemanager/containerregistry/ContainerRegistryManagementClient.java b/sdk/containerregistry/mgmt/src/main/java/com/azure/resourcemanager/containerregistry/ContainerRegistryManagementClient.java index 4b9dcf1a63c4..18360da80224 100644 --- a/sdk/containerregistry/mgmt/src/main/java/com/azure/resourcemanager/containerregistry/ContainerRegistryManagementClient.java +++ b/sdk/containerregistry/mgmt/src/main/java/com/azure/resourcemanager/containerregistry/ContainerRegistryManagementClient.java @@ -8,7 +8,7 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.management.AzureEnvironment; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.AzureServiceClient; +import com.azure.resourcemanager.resources.fluentcore.AzureServiceClient; import com.azure.resourcemanager.containerregistry.fluent.OperationsClient; import com.azure.resourcemanager.containerregistry.fluent.RegistriesClient; import com.azure.resourcemanager.containerregistry.fluent.ReplicationsClient; diff --git a/sdk/containerservice/mgmt/src/main/java/com/azure/resourcemanager/containerservice/ContainerServiceManagementClient.java b/sdk/containerservice/mgmt/src/main/java/com/azure/resourcemanager/containerservice/ContainerServiceManagementClient.java index 9903234e609c..82e9c1d84092 100644 --- a/sdk/containerservice/mgmt/src/main/java/com/azure/resourcemanager/containerservice/ContainerServiceManagementClient.java +++ b/sdk/containerservice/mgmt/src/main/java/com/azure/resourcemanager/containerservice/ContainerServiceManagementClient.java @@ -8,7 +8,7 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.management.AzureEnvironment; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.AzureServiceClient; +import com.azure.resourcemanager.resources.fluentcore.AzureServiceClient; import com.azure.resourcemanager.containerservice.fluent.AgentPoolsClient; import com.azure.resourcemanager.containerservice.fluent.ContainerServicesClient; import com.azure.resourcemanager.containerservice.fluent.ManagedClustersClient; diff --git a/sdk/core/azure-core-amqp/pom.xml b/sdk/core/azure-core-amqp/pom.xml index a9161b7cdca2..52cbd49021fc 100644 --- a/sdk/core/azure-core-amqp/pom.xml +++ b/sdk/core/azure-core-amqp/pom.xml @@ -58,7 +58,7 @@ com.azure azure-core - 1.7.0-beta.1 + 1.7.0-beta.2 com.microsoft.azure diff --git a/sdk/core/azure-core-experimental/pom.xml b/sdk/core/azure-core-experimental/pom.xml index 5f4a23951b9c..40c95bbb8d70 100644 --- a/sdk/core/azure-core-experimental/pom.xml +++ b/sdk/core/azure-core-experimental/pom.xml @@ -58,7 +58,7 @@ com.azure azure-core - 1.7.0-beta.1 + 1.7.0-beta.2 diff --git a/sdk/core/azure-core-http-jdk-httpclient/pom.xml b/sdk/core/azure-core-http-jdk-httpclient/pom.xml index e57873d88385..d16188286a22 100644 --- a/sdk/core/azure-core-http-jdk-httpclient/pom.xml +++ b/sdk/core/azure-core-http-jdk-httpclient/pom.xml @@ -62,14 +62,14 @@ com.azure azure-core - 1.7.0-beta.1 + 1.7.0-beta.2 com.azure azure-core - 1.7.0-beta.1 + 1.7.0-beta.2 test-jar test diff --git a/sdk/core/azure-core-http-netty/pom.xml b/sdk/core/azure-core-http-netty/pom.xml index 1f42d0515377..b72986cae435 100644 --- a/sdk/core/azure-core-http-netty/pom.xml +++ b/sdk/core/azure-core-http-netty/pom.xml @@ -60,7 +60,7 @@ com.azure azure-core - 1.7.0-beta.1 + 1.7.0-beta.2 @@ -117,7 +117,7 @@ com.azure azure-core - 1.7.0-beta.1 + 1.7.0-beta.2 test-jar test diff --git a/sdk/core/azure-core-http-okhttp/pom.xml b/sdk/core/azure-core-http-okhttp/pom.xml index d4abbfc69a89..7a320cc73089 100644 --- a/sdk/core/azure-core-http-okhttp/pom.xml +++ b/sdk/core/azure-core-http-okhttp/pom.xml @@ -60,7 +60,7 @@ com.azure azure-core - 1.7.0-beta.1 + 1.7.0-beta.2 @@ -73,7 +73,7 @@ com.azure azure-core - 1.7.0-beta.1 + 1.7.0-beta.2 test-jar test diff --git a/sdk/core/azure-core-management/CHANGELOG.md b/sdk/core/azure-core-management/CHANGELOG.md index fd59fdd77eaa..75f6d9d80240 100644 --- a/sdk/core/azure-core-management/CHANGELOG.md +++ b/sdk/core/azure-core-management/CHANGELOG.md @@ -1,8 +1,14 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.3 (Unreleased) +## 1.0.0-beta.2 (2020-07-09) + +- Added additional `ManagementError` constructors. +- Added additional `PollingState` checks. +- Fixed polling status HTTP status code check to include `204`. + ## 1.0.0-beta.1 (2020-06-17) - `PollerFactory` for polling of long-running operation. - `ManagementException` and `ManagementError` for exception and error handling. diff --git a/sdk/core/azure-core-management/README.md b/sdk/core/azure-core-management/README.md index 8e72f06096af..5284eb7e4c36 100644 --- a/sdk/core/azure-core-management/README.md +++ b/sdk/core/azure-core-management/README.md @@ -15,7 +15,7 @@ Azure Core Management library is a collection of classes common to the Azure ARM com.azure azure-core-management - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) @@ -37,4 +37,4 @@ Azure Projects Contribution Guidelines](http://azure.github.io/guidelines.html). 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 \ No newline at end of file +1. Create new Pull Request diff --git a/sdk/core/azure-core-management/pom.xml b/sdk/core/azure-core-management/pom.xml index d289d4e28b1c..6d80e9630b8d 100644 --- a/sdk/core/azure-core-management/pom.xml +++ b/sdk/core/azure-core-management/pom.xml @@ -13,7 +13,7 @@ com.azure azure-core-management - 1.0.0-beta.2 + 1.0.0-beta.3 jar Microsoft Azure Management Java Core Library @@ -59,7 +59,7 @@ com.azure azure-core - 1.7.0-beta.1 + 1.7.0-beta.2 diff --git a/sdk/core/azure-core-management/src/main/java/module-info.java b/sdk/core/azure-core-management/src/main/java/module-info.java index c4cad3ac196e..4c3b3e3480bb 100644 --- a/sdk/core/azure-core-management/src/main/java/module-info.java +++ b/sdk/core/azure-core-management/src/main/java/module-info.java @@ -9,9 +9,14 @@ exports com.azure.core.management.serializer; exports com.azure.core.management.exception; - opens com.azure.core.management to com.fasterxml.jackson.databind; - opens com.azure.core.management.exception to com.fasterxml.jackson.databind; - opens com.azure.core.management.implementation.polling to com.fasterxml.jackson.databind; + opens com.azure.core.management to + com.fasterxml.jackson.databind, + com.azure.core; + opens com.azure.core.management.exception to + com.fasterxml.jackson.databind, + com.azure.core; + opens com.azure.core.management.implementation.polling to + com.fasterxml.jackson.databind; uses com.azure.core.http.HttpClientProvider; } diff --git a/sdk/core/azure-core-serializer-avro-apache/pom.xml b/sdk/core/azure-core-serializer-avro-apache/pom.xml index a5b115a6b410..cdc26f0ca952 100644 --- a/sdk/core/azure-core-serializer-avro-apache/pom.xml +++ b/sdk/core/azure-core-serializer-avro-apache/pom.xml @@ -58,7 +58,7 @@ com.azure azure-core - 1.7.0-beta.1 + 1.7.0-beta.2 com.azure diff --git a/sdk/core/azure-core-serializer-avro-jackson/pom.xml b/sdk/core/azure-core-serializer-avro-jackson/pom.xml index 5c41d67aa0df..c1fc1800e024 100644 --- a/sdk/core/azure-core-serializer-avro-jackson/pom.xml +++ b/sdk/core/azure-core-serializer-avro-jackson/pom.xml @@ -58,7 +58,7 @@ com.azure azure-core - 1.7.0-beta.1 + 1.7.0-beta.2 com.azure diff --git a/sdk/core/azure-core-serializer-json-gson/pom.xml b/sdk/core/azure-core-serializer-json-gson/pom.xml index ec9d869d0b21..4e83fcebd97d 100644 --- a/sdk/core/azure-core-serializer-json-gson/pom.xml +++ b/sdk/core/azure-core-serializer-json-gson/pom.xml @@ -58,7 +58,7 @@ com.azure azure-core - 1.7.0-beta.1 + 1.7.0-beta.2 com.azure diff --git a/sdk/core/azure-core-serializer-json-jackson/pom.xml b/sdk/core/azure-core-serializer-json-jackson/pom.xml index 137d27d00b1e..e6207c7420b2 100644 --- a/sdk/core/azure-core-serializer-json-jackson/pom.xml +++ b/sdk/core/azure-core-serializer-json-jackson/pom.xml @@ -58,7 +58,7 @@ com.azure azure-core - 1.7.0-beta.1 + 1.7.0-beta.2 com.azure diff --git a/sdk/core/azure-core-test/pom.xml b/sdk/core/azure-core-test/pom.xml index cdb3b25016ec..8364cdb34d29 100644 --- a/sdk/core/azure-core-test/pom.xml +++ b/sdk/core/azure-core-test/pom.xml @@ -37,7 +37,7 @@ com.azure azure-core - 1.7.0-beta.1 + 1.7.0-beta.2 diff --git a/sdk/core/azure-core-tracing-opentelemetry/pom.xml b/sdk/core/azure-core-tracing-opentelemetry/pom.xml index 3453676b9731..0b06941e1d5c 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/pom.xml +++ b/sdk/core/azure-core-tracing-opentelemetry/pom.xml @@ -40,7 +40,7 @@ com.azure azure-core - 1.7.0-beta.1 + 1.7.0-beta.2 diff --git a/sdk/core/azure-core/CHANGELOG.md b/sdk/core/azure-core/CHANGELOG.md index 915daf4d6353..45e38e20fcf5 100644 --- a/sdk/core/azure-core/CHANGELOG.md +++ b/sdk/core/azure-core/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 1.7.0-beta.2 (Unreleased) + +## 1.7.0-beta.1 (2020-07-08) + +- Added `TokenRefreshOptions()` to `TokenCredential`, with a default token refresh offset of 2 minutes, and a default token refresh retry timeout of 30 seconds. + ## 1.7.0-beta.1 (2020-07-08) - Added `TokenRefreshOptions()` to `TokenCredential`, with a default token refresh offset of 2 minutes, and a default token refresh retry timeout of 30 seconds. diff --git a/sdk/core/azure-core/pom.xml b/sdk/core/azure-core/pom.xml index 258109d8751a..e085c9e8a879 100644 --- a/sdk/core/azure-core/pom.xml +++ b/sdk/core/azure-core/pom.xml @@ -15,7 +15,7 @@ com.azure azure-core jar - 1.7.0-beta.1 + 1.7.0-beta.2 Microsoft Azure Java Core Library This package contains core types for Azure Java clients. diff --git a/sdk/cosmos/azure-cosmos-benchmark/ctl-image-build.yml b/sdk/cosmos/azure-cosmos-benchmark/ctl-image-build.yml new file mode 100644 index 000000000000..1b0740ea20d7 --- /dev/null +++ b/sdk/cosmos/azure-cosmos-benchmark/ctl-image-build.yml @@ -0,0 +1,53 @@ +jobs: + - job: Cosmos_CTL + timeoutInMinutes: 20 + variables: + - template: /eng/pipelines/templates/variables/globals.yml + - name: ContainerRegistryName + value: 'javactl' + - name: ContainerRegistryUserName + value: 'javactl' + - name: ContainerRegistryUrl + value: 'javactl.azurecr.io' + + pool: + vmImage: 'ubuntu-18.04' + + steps: + - task: Maven@3 + displayName: 'Build Cosmos and Benchmark' + inputs: + mavenPomFile: pom.xml + goals: 'package' + # The -Ppackage-assembly profile packages up both libraries into one package + options: '$(DefaultOptions) -Ppackage-assembly -DskipTests -Dgpg.skip -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dspotbugs.skip=true -Drevapi.skip=true -pl com.azure:azure-cosmos,com.azure:azure-cosmos-benchmark -am' + javaHomeOption: 'JDKVersion' + jdkVersionOption: $(JavaBuildVersion) + jdkArchitectureOption: 'x64' + publishJUnitResults: false + + - task: CopyFiles@2 + displayName: 'Copy benchmark jar' + inputs: + SourceFolder: '$(build.sourcesdirectory)/sdk/cosmos/azure-cosmos-benchmark/target' + Contents: '*' + TargetFolder: $(Agent.TempDirectory)/ctl + + - task: CopyFiles@2 + displayName: 'Copy docker config files' + inputs: + SourceFolder: '$(build.sourcesdirectory)/sdk/cosmos/azure-cosmos-benchmark/ctl' + TargetFolder: $(Agent.TempDirectory)/ctl + + # Below will build the image and push it to azure container registry + - pwsh: | + cd $(Agent.TempDirectory)/ctl + Write-Host "Executing docker build . -t java-ctl" + docker build . -t java-ctl + Write-Host "Executing az acr login --name $(ContainerRegistryName) -u $(ContainerRegistryUserName) -p $(java-cosmos-container-registry-pwd)" + az acr login --name $(ContainerRegistryName) -u $(ContainerRegistryUserName) -p $(java-cosmos-container-registry-pwd) + Write-Host "Executing docker tag java-ctl $(ContainerRegistryUrl)/javactl/benchmark" + docker tag java-ctl $(ContainerRegistryUrl)/javactl/benchmark + Write-Host "Executing docker push $(ContainerRegistryUrl)/javactl/benchmark" + docker push $(ContainerRegistryUrl)/javactl/benchmark + displayName: 'Build and push docker image to registry' diff --git a/sdk/cosmos/azure-cosmos/pom.xml b/sdk/cosmos/azure-cosmos/pom.xml index 049bb9b7fab0..e64311be2eeb 100644 --- a/sdk/cosmos/azure-cosmos/pom.xml +++ b/sdk/cosmos/azure-cosmos/pom.xml @@ -120,7 +120,7 @@ Licensed under the MIT License. com.azure azure-core - 1.6.0 + 1.7.0-beta.1 io.netty 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 ed30bac22843..13892748126c 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 @@ -668,8 +668,10 @@ private void buildConnectionPolicy() { // Check if the user passed additional gateway connection configuration if (this.gatewayConnectionConfig != null) { this.connectionPolicy.setMaxConnectionPoolSize(this.gatewayConnectionConfig.getMaxConnectionPoolSize()); + // TODO(kuthapar): potential bug - when we expose requestTimeout from direct and gateway connection config, + // as gateway connection config will overwrite direct connection config settings this.connectionPolicy.setRequestTimeout(this.gatewayConnectionConfig.getRequestTimeout()); - this.connectionPolicy.setIdleConnectionTimeout(this.gatewayConnectionConfig.getIdleConnectionTimeout()); + this.connectionPolicy.setIdleHttpConnectionTimeout(this.gatewayConnectionConfig.getIdleConnectionTimeout()); } } else if (gatewayConnectionConfig != null) { this.connectionPolicy = new ConnectionPolicy(gatewayConnectionConfig); diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/DirectConnectionConfig.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/DirectConnectionConfig.java index 740609bca182..54b5427873df 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/DirectConnectionConfig.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/DirectConnectionConfig.java @@ -15,8 +15,8 @@ */ public final class DirectConnectionConfig { // Constants - private static final Duration DEFAULT_IDLE_ENDPOINT_TIMEOUT = Duration.ofSeconds(70L); - private static final Duration DEFAULT_CONNECT_TIMEOUT = Duration.ofSeconds(60L); + private static final Duration DEFAULT_IDLE_ENDPOINT_TIMEOUT = Duration.ofHours(1l); + private static final Duration DEFAULT_CONNECT_TIMEOUT = Duration.ofSeconds(5L); private static final Duration DEFAULT_REQUEST_TIMEOUT = Duration.ofSeconds(5L); private static final int DEFAULT_MAX_CONNECTIONS_PER_ENDPOINT = 130; private static final int DEFAULT_MAX_REQUESTS_PER_CONNECTION = 30; @@ -55,7 +55,7 @@ public static DirectConnectionConfig getDefaultConfig() { * * Configures timeout for underlying Netty Channel {@link ChannelOption#CONNECT_TIMEOUT_MILLIS} * - * By default, the connect timeout is 60 seconds. + * By default, the connect timeout is 5 seconds. * * @return direct connect timeout */ @@ -69,7 +69,7 @@ public Duration getConnectTimeout() { * * Configures timeout for underlying Netty Channel {@link ChannelOption#CONNECT_TIMEOUT_MILLIS} * - * By default, the connect timeout is 60 seconds. + * By default, the connect timeout is 5 seconds. * * @param connectTimeout the connection timeout * @return the {@link DirectConnectionConfig} @@ -112,7 +112,7 @@ public DirectConnectionConfig setIdleConnectionTimeout(Duration idleConnectionTi /** * Gets the idle endpoint timeout * - * Default value is 70 seconds. + * Default value is 1 hour. * * If there are no requests to a specific endpoint for idle endpoint timeout duration, * direct client closes all connections to that endpoint to save resources and I/O cost. @@ -126,7 +126,7 @@ public Duration getIdleEndpointTimeout() { /** * Sets the idle endpoint timeout * - * Default value is 70 seconds. + * Default value is 1 hour. * * If there are no requests to a specific endpoint for idle endpoint timeout duration, * direct client closes all connections to that endpoint to save resources and I/O cost. diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/BackoffRetryUtility.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/BackoffRetryUtility.java index f57eeec24e2f..6a9d496ccbc8 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/BackoffRetryUtility.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/BackoffRetryUtility.java @@ -2,6 +2,7 @@ // Licensed under the MIT License. package com.azure.cosmos.implementation; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.time.Duration; @@ -38,6 +39,17 @@ static public Mono executeRetry(Callable> callbackMethod, }).retryWhen(RetryUtils.toRetryWhenFunc(retryPolicy)); } + static public Flux fluxExecuteRetry(Callable> callbackMethod, IRetryPolicy retryPolicy) { + + return Flux.defer(() -> { + try { + return callbackMethod.call(); + } catch (Exception e) { + return Flux.error(e); + } + }).retryWhen(RetryUtils.toRetryWhenFunc(retryPolicy)); + } + static public Mono executeAsync( Function, Mono> callbackMethod, IRetryPolicy retryPolicy, Function, Mono> inBackoffAlternateCallbackMethod, 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 9362d784712e..a9433289dcc9 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 @@ -27,7 +27,6 @@ public final class ConnectionPolicy { private ConnectionMode connectionMode; private boolean endpointDiscoveryEnabled; - private Duration idleConnectionTimeout; private boolean multipleWriteRegionsEnabled; private List preferredRegions; private boolean readRequestsFallbackEnabled; @@ -38,19 +37,21 @@ public final class ConnectionPolicy { private int maxConnectionPoolSize; private Duration requestTimeout; private ProxyOptions proxy; + private Duration idleHttpConnectionTimeout; // Direct connection config properties private Duration connectTimeout; private Duration idleEndpointTimeout; private int maxConnectionsPerEndpoint; private int maxRequestsPerConnection; + private Duration idleTcpConnectionTimeout; /** * Constructor. */ public ConnectionPolicy(GatewayConnectionConfig gatewayConnectionConfig) { this(ConnectionMode.GATEWAY); - this.idleConnectionTimeout = gatewayConnectionConfig.getIdleConnectionTimeout(); + this.idleHttpConnectionTimeout = gatewayConnectionConfig.getIdleConnectionTimeout(); this.maxConnectionPoolSize = gatewayConnectionConfig.getMaxConnectionPoolSize(); this.requestTimeout = BridgeInternal.getRequestTimeoutFromGatewayConnectionConfig(gatewayConnectionConfig); this.proxy = gatewayConnectionConfig.getProxy(); @@ -59,7 +60,7 @@ public ConnectionPolicy(GatewayConnectionConfig gatewayConnectionConfig) { public ConnectionPolicy(DirectConnectionConfig directConnectionConfig) { this(ConnectionMode.DIRECT); this.connectTimeout = directConnectionConfig.getConnectTimeout(); - this.idleConnectionTimeout = directConnectionConfig.getIdleConnectionTimeout(); + this.idleTcpConnectionTimeout = directConnectionConfig.getIdleConnectionTimeout(); this.idleEndpointTimeout = directConnectionConfig.getIdleEndpointTimeout(); this.maxConnectionsPerEndpoint = directConnectionConfig.getMaxConnectionsPerEndpoint(); this.maxRequestsPerConnection = directConnectionConfig.getMaxRequestsPerConnection(); @@ -149,24 +150,54 @@ public ConnectionPolicy setMaxConnectionPoolSize(int maxConnectionPoolSize) { } /** - * Gets the value of the timeout for an idle connection, the default is 60 + * Gets the value of the timeout for an idle http connection, the default is 60 * seconds. * * @return Idle connection timeout duration. */ - public Duration getIdleConnectionTimeout() { - return this.idleConnectionTimeout; + public Duration getIdleHttpConnectionTimeout() { + return this.idleHttpConnectionTimeout; } /** - * sets the value of the timeout for an idle connection. After that time, + * sets the value of the timeout for an idle http connection. After that time, * the connection will be automatically closed. * - * @param idleConnectionTimeout the duration for an idle connection. + * @param idleHttpConnectionTimeout the duration for an idle connection. * @return the ConnectionPolicy. */ - public ConnectionPolicy setIdleConnectionTimeout(Duration idleConnectionTimeout) { - this.idleConnectionTimeout = idleConnectionTimeout; + public ConnectionPolicy setIdleHttpConnectionTimeout(Duration idleHttpConnectionTimeout) { + this.idleHttpConnectionTimeout = idleHttpConnectionTimeout; + return this; + } + + /** + * Gets the idle tcp connection timeout for direct client + * + * Default value is {@link Duration#ZERO} + * + * Direct client doesn't close a single connection to an endpoint + * by default unless specified. + * + * @return idle tcp connection timeout + */ + public Duration getIdleTcpConnectionTimeout() { + return idleTcpConnectionTimeout; + } + + /** + * Sets the idle tcp connection timeout + * + * Default value is {@link Duration#ZERO} + * + * Direct client doesn't close a single connection to an endpoint + * by default unless specified. + * + * @param idleTcpConnectionTimeout idle connection timeout + * @return the {@link ConnectionPolicy} + */ + public ConnectionPolicy setIdleTcpConnectionTimeout(Duration idleTcpConnectionTimeout) { + this.idleTcpConnectionTimeout = idleTcpConnectionTimeout; return this; } @@ -451,7 +482,8 @@ public String toString() { "requestTimeout=" + requestTimeout + ", connectionMode=" + connectionMode + ", maxConnectionPoolSize=" + maxConnectionPoolSize + - ", idleConnectionTimeout=" + idleConnectionTimeout + + ", idleHttpConnectionTimeout=" + idleHttpConnectionTimeout + + ", idleTcpConnectionTimeout=" + idleTcpConnectionTimeout + ", userAgentSuffix='" + userAgentSuffix + '\'' + ", throttlingRetryOptions=" + throttlingRetryOptions + ", endpointDiscoveryEnabled=" + endpointDiscoveryEnabled + diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/InvalidPartitionExceptionRetryPolicy.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/InvalidPartitionExceptionRetryPolicy.java index 4c05f78ed843..5083b6210aac 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/InvalidPartitionExceptionRetryPolicy.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/InvalidPartitionExceptionRetryPolicy.java @@ -41,7 +41,9 @@ public InvalidPartitionExceptionRetryPolicy(RxCollectionCache collectionCache, @Override public void onBeforeSendRequest(RxDocumentServiceRequest request) { this.request = request; - this.nextPolicy.onBeforeSendRequest(request); + if (this.nextPolicy != null) { + this.nextPolicy.onBeforeSendRequest(request); + } } @Override @@ -56,7 +58,7 @@ public Mono shouldRetry(Exception e) { // TODO: this is blocking. is that fine? if(this.cosmosQueryRequestOptions != null) { this.clientCollectionCache.refresh( - BridgeInternal.getMetaDataDiagnosticContext(this.request.requestContext.cosmosDiagnostics), + this.request != null ? BridgeInternal.getMetaDataDiagnosticContext(this.request.requestContext.cosmosDiagnostics) : null, collectionLink, ModelBridgeInternal.getPropertiesFromQueryRequestOptions(this.cosmosQueryRequestOptions)); } else { @@ -73,6 +75,9 @@ public Mono shouldRetry(Exception e) { } } - return this.nextPolicy.shouldRetry(e); + if (this.nextPolicy != null) { + return this.nextPolicy.shouldRetry(e); + } + return Mono.just(ShouldRetryResult.error(e)); } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ObservableHelper.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ObservableHelper.java index 91309bb3e0b2..2865eb351370 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ObservableHelper.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ObservableHelper.java @@ -44,4 +44,21 @@ static public Mono inlineIfPossibleAsObs(Callable> function, IRet return BackoffRetryUtility.executeRetry(() -> function.call(), retryPolicy); } } + + static public Flux fluxInlineIfPossibleAsObs(Callable> function, IRetryPolicy retryPolicy) { + + if (retryPolicy == null) { + // shortcut + return Flux.defer(() -> { + try { + return function.call(); + } catch (Exception e) { + return Flux.error(e); + } + }); + + } else { + return BackoffRetryUtility.fluxExecuteRetry(() -> function.call(), retryPolicy); + } + } } 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 152da0570689..120f0efd21bc 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 @@ -357,7 +357,7 @@ RxGatewayStoreModel createRxGatewayProxy(ISessionContainer sessionContainer, private HttpClient httpClient() { HttpClientConfig httpClientConfig = new HttpClientConfig(this.configs) - .withMaxIdleConnectionTimeout(this.connectionPolicy.getIdleConnectionTimeout()) + .withMaxIdleConnectionTimeout(this.connectionPolicy.getIdleHttpConnectionTimeout()) .withPoolSize(this.connectionPolicy.getMaxConnectionPoolSize()) .withProxy(this.connectionPolicy.getProxy()) .withRequestTimeout(this.connectionPolicy.getRequestTimeout()); @@ -560,18 +560,42 @@ private String parentResourceLinkToQueryLink(String parentResouceLink, ResourceT } private Flux> createQuery( - String parentResourceLink, + String parentResourceLink, + SqlQuerySpec sqlQuery, + CosmosQueryRequestOptions options, + Class klass, + ResourceType resourceTypeEnum) { + + String resourceLink = parentResourceLinkToQueryLink(parentResourceLink, resourceTypeEnum); + UUID activityId = Utils.randomUUID(); + IDocumentQueryClient queryClient = documentQueryClientImpl(RxDocumentClientImpl.this); + + // 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. + // For default document context, it already wired up InvalidPartitionExceptionRetry, but there is no harm to wire it again here + InvalidPartitionExceptionRetryPolicy invalidPartitionExceptionRetryPolicy = new InvalidPartitionExceptionRetryPolicy( + this.collectionCache, + null, + resourceLink, + options); + + return ObservableHelper.fluxInlineIfPossibleAsObs( + () -> createQueryInternal(resourceLink, sqlQuery, options, klass, resourceTypeEnum, queryClient, activityId), + invalidPartitionExceptionRetryPolicy); + } + + private Flux> createQueryInternal( + String resourceLink, SqlQuerySpec sqlQuery, CosmosQueryRequestOptions options, Class klass, - ResourceType resourceTypeEnum) { + ResourceType resourceTypeEnum, + IDocumentQueryClient queryClient, + UUID activityId) { - String queryResourceLink = parentResourceLinkToQueryLink(parentResourceLink, resourceTypeEnum); - - UUID activityId = Utils.randomUUID(); - IDocumentQueryClient queryClient = documentQueryClientImpl(RxDocumentClientImpl.this); Flux> executionContext = - DocumentQueryExecutionContextFactory.createDocumentQueryExecutionContextAsync(queryClient, resourceTypeEnum, klass, sqlQuery , options, queryResourceLink, false, activityId); + DocumentQueryExecutionContextFactory.createDocumentQueryExecutionContextAsync(queryClient, resourceTypeEnum, klass, sqlQuery , options, resourceLink, false, activityId); + return executionContext.flatMap(iDocumentQueryExecutionContext -> { QueryInfo queryInfo = null; if (iDocumentQueryExecutionContext instanceof PipelinedDocumentQueryExecutionContext) { diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/StoredProcedureResponse.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/StoredProcedureResponse.java index 90c50a5b0a17..02f2c869ed28 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/StoredProcedureResponse.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/StoredProcedureResponse.java @@ -123,7 +123,8 @@ public String getResponseAsString() { * @return the output string from the stored procedure console.log() statements. */ public String getScriptLog() { - return this.response.getResponseHeaders().get(HttpConstants.HttpHeaders.SCRIPT_LOG_RESULTS); + String scriptLog = this.response.getResponseHeaders().get(HttpConstants.HttpHeaders.SCRIPT_LOG_RESULTS); + return Utils.decodeAsUTF8String(scriptLog); } /** 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 b0809bd7eb98..d91327ff08ed 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 @@ -16,6 +16,8 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.module.afterburner.AfterburnerModule; import io.netty.buffer.ByteBuf; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -23,6 +25,7 @@ import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URISyntaxException; +import java.net.URLDecoder; import java.net.URLEncoder; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; @@ -46,6 +49,9 @@ * This is meant to be internally used only by our sdk. */ public class Utils { + + private final static Logger logger = LoggerFactory.getLogger(Utils.class); + private static final int ONE_KB = 1024; private static final ZoneId GMT_ZONE_ID = ZoneId.of("GMT"); public static final Base64.Encoder Base64Encoder = Base64.getEncoder(); @@ -94,6 +100,18 @@ public static String encodeBase64String(byte[] binaryData) { return encodedString; } + public static String decodeAsUTF8String(String inputString) { + if (inputString == null || inputString.isEmpty()) { + return inputString; + } + try { + return URLDecoder.decode(inputString, StandardCharsets.UTF_8.toString()); + } catch (UnsupportedEncodingException e) { + logger.warn("Error while decoding input string", e); + return inputString; + } + } + /** * Checks whether the specified link is Name based or not * diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/RntbdTransportClient.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/RntbdTransportClient.java index 71682cdbd284..837163ab5725 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/RntbdTransportClient.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/RntbdTransportClient.java @@ -254,7 +254,7 @@ private Options(final ConnectionPolicy connectionPolicy) { this.bufferPageSize = 8192; this.connectionAcquisitionTimeout = Duration.ZERO; this.connectTimeout = connectionPolicy.getConnectTimeout(); - this.idleChannelTimeout = connectionPolicy.getIdleConnectionTimeout(); + this.idleChannelTimeout = connectionPolicy.getIdleTcpConnectionTimeout(); this.idleEndpointTimeout = Duration.ofSeconds(70L); this.maxBufferCapacity = 8192 << 10; this.maxChannelsPerEndpoint = connectionPolicy.getMaxConnectionsPerEndpoint(); @@ -484,7 +484,7 @@ public Builder(ConnectionPolicy connectionPolicy) { this.bufferPageSize = DEFAULT_OPTIONS.bufferPageSize; this.connectionAcquisitionTimeout = DEFAULT_OPTIONS.connectionAcquisitionTimeout; this.connectTimeout = connectionPolicy.getConnectTimeout(); - this.idleChannelTimeout = connectionPolicy.getIdleConnectionTimeout(); + this.idleChannelTimeout = connectionPolicy.getIdleTcpConnectionTimeout(); this.idleEndpointTimeout = DEFAULT_OPTIONS.idleEndpointTimeout; this.maxBufferCapacity = DEFAULT_OPTIONS.maxBufferCapacity; this.maxChannelsPerEndpoint = connectionPolicy.getMaxConnectionsPerEndpoint(); diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/AggregateDocumentQueryExecutionContext.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/AggregateDocumentQueryExecutionContext.java index 6c253ba3857d..bcb43e6a7ba6 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/AggregateDocumentQueryExecutionContext.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/AggregateDocumentQueryExecutionContext.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -import java.util.function.Function; +import java.util.function.BiFunction; public class AggregateDocumentQueryExecutionContext implements IDocumentQueryExecutionComponent{ @@ -57,8 +57,8 @@ public Flux> drainAsync(int maxPageSize) { .map( superList -> { double requestCharge = 0; - List aggregateResults = new ArrayList(); - HashMap headers = new HashMap(); + List aggregateResults = new ArrayList<>(); + HashMap headers = new HashMap<>(); for(FeedResponse page : superList) { @@ -104,23 +104,22 @@ public Flux> drainAsync(int maxPageSize) { } public static Flux> createAsync( - Function>> createSourceComponentFunction, + BiFunction, Flux>> createSourceComponentFunction, Collection aggregates, Map groupByAliasToAggregateType, List groupByAliases, boolean hasSelectValue, - String continuationToken) { + String continuationToken, + PipelinedDocumentQueryParams documentQueryParams) { return createSourceComponentFunction - .apply(continuationToken) - .map(component -> { - return new AggregateDocumentQueryExecutionContext(component, - new ArrayList<>(aggregates), - groupByAliasToAggregateType, - groupByAliases, - hasSelectValue, - continuationToken); - }); + .apply(continuationToken, documentQueryParams) + .map(component -> new AggregateDocumentQueryExecutionContext(component, + new ArrayList<>(aggregates), + groupByAliasToAggregateType, + groupByAliases, + hasSelectValue, + continuationToken)); } public IDocumentQueryExecutionComponent getComponent() { diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DistinctDocumentQueryExecutionContext.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DistinctDocumentQueryExecutionContext.java index fa5ef23280be..39e61580b298 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DistinctDocumentQueryExecutionContext.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DistinctDocumentQueryExecutionContext.java @@ -18,7 +18,7 @@ import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicReference; -import java.util.function.Function; +import java.util.function.BiFunction; public class DistinctDocumentQueryExecutionContext implements IDocumentQueryExecutionComponent { private final IDocumentQueryExecutionComponent component; @@ -43,9 +43,10 @@ private DistinctDocumentQueryExecutionContext( } public static Flux> createAsync( - Function>> createSourceComponentFunction, + BiFunction, Flux>> createSourceComponentFunction, DistinctQueryType distinctQueryType, - String continuationToken) { + String continuationToken, + PipelinedDocumentQueryParams documentQueryParams) { Utils.ValueHolder outDistinctcontinuationtoken = new Utils.ValueHolder<>(); DistinctContinuationToken distinctContinuationToken = new DistinctContinuationToken(null /*lasthash*/, @@ -70,11 +71,9 @@ public static Flux> cre final UInt128 continuationTokenLastHash = distinctContinuationToken.getLastHash(); - return createSourceComponentFunction.apply(distinctContinuationToken.getSourceToken()).map(component -> { - return new DistinctDocumentQueryExecutionContext(component, - distinctQueryType, - continuationTokenLastHash); - }); + return createSourceComponentFunction + .apply(distinctContinuationToken.getSourceToken(), documentQueryParams) + .map(component -> new DistinctDocumentQueryExecutionContext(component, distinctQueryType, continuationTokenLastHash)); } IDocumentQueryExecutionComponent getComponent() { 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 41b48c65fb50..19b225bde665 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 @@ -195,20 +195,21 @@ public static Flux documentQueryParams = new PipelinedDocumentQueryParams( + resourceTypeEnum, + resourceType, + query, + resourceLink, + collectionRid, + getLazyFeedResponse, + isContinuationExpected, + initialPageSize, + targetRanges, + partitionedQueryExecutionInfo.getQueryInfo(), + cosmosQueryRequestOptions, + correlatedActivityId); + + return PipelinedDocumentQueryExecutionContext.createAsync(client, documentQueryParams); } public static Flux> createReadManyQueryAsync( diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/GroupByDocumentQueryExecutionContext.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/GroupByDocumentQueryExecutionContext.java index 83bf12d464fd..d9f63ba24e92 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/GroupByDocumentQueryExecutionContext.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/GroupByDocumentQueryExecutionContext.java @@ -19,7 +19,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.function.Function; +import java.util.function.BiFunction; public final class GroupByDocumentQueryExecutionContext implements IDocumentQueryExecutionComponent { @@ -40,11 +40,12 @@ public final class GroupByDocumentQueryExecutionContext impl } public static Flux> createAsync( - Function>> createSourceComponentFunction, + BiFunction, Flux>> createSourceComponentFunction, String continuationToken, Map groupByAliasToAggregateType, List orderedAliases, - boolean hasSelectValue) { + boolean hasSelectValue, + PipelinedDocumentQueryParams documentQueryParams) { if (continuationToken != null) { CosmosException dce = new BadRequestException(CONTINUATION_TOKEN_NOT_SUPPORTED_WITH_GROUP_BY); return Flux.error(dce); @@ -57,7 +58,7 @@ public static Flux> cre } GroupingTable table = new GroupingTable(groupByAliasToAggregateType, orderedAliases, hasSelectValue); // Have to pass non-null continuation token once supported - return createSourceComponentFunction.apply(null) + return createSourceComponentFunction.apply(null, documentQueryParams) .map(component -> new GroupByDocumentQueryExecutionContext<>(component, table)); } 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 4786c7648ec6..623b5ea7c5ec 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 @@ -77,39 +77,32 @@ private OrderByDocumentQueryExecutionContext( public static Flux> createAsync( IDocumentQueryClient client, - ResourceType resourceTypeEnum, - Class resourceType, - SqlQuerySpec expression, - CosmosQueryRequestOptions cosmosQueryRequestOptions, - String resourceLink, - String collectionRid, - PartitionedQueryExecutionInfo partitionedQueryExecutionInfo, - List partitionKeyRanges, - int initialPageSize, - boolean isContinuationExpected, - boolean getLazyFeedResponse, - UUID correlatedActivityId) { + PipelinedDocumentQueryParams initParams) { - OrderByDocumentQueryExecutionContext context = new OrderByDocumentQueryExecutionContext(client, - partitionKeyRanges, - resourceTypeEnum, - resourceType, - expression, - cosmosQueryRequestOptions, - resourceLink, - partitionedQueryExecutionInfo.getQueryInfo().getRewrittenQuery(), - isContinuationExpected, - getLazyFeedResponse, - new OrderbyRowComparer(partitionedQueryExecutionInfo.getQueryInfo().getOrderBy()), - collectionRid, - correlatedActivityId); + OrderByDocumentQueryExecutionContext context = new OrderByDocumentQueryExecutionContext( + client, + initParams.getPartitionKeyRanges(), + initParams.getResourceTypeEnum(), + initParams.getResourceType(), + initParams.getQuery(), + initParams.getCosmosQueryRequestOptions(), + initParams.getResourceLink(), + initParams.getQueryInfo().getRewrittenQuery(), + initParams.isContinuationExpected(), + initParams.isGetLazyResponseFeed(), + new OrderbyRowComparer(initParams.getQueryInfo().getOrderBy()), + initParams.getCollectionRid(), + initParams.getCorrelatedActivityId()); + + context.setTop(initParams.getTop()); try { - context.initialize(partitionKeyRanges, - partitionedQueryExecutionInfo.getQueryInfo().getOrderBy(), - partitionedQueryExecutionInfo.getQueryInfo().getOrderByExpressions(), - initialPageSize, - ModelBridgeInternal.getRequestContinuationFromQueryRequestOptions(cosmosQueryRequestOptions)); + context.initialize( + initParams.getPartitionKeyRanges(), + initParams.getQueryInfo().getOrderBy(), + initParams.getQueryInfo().getOrderByExpressions(), + initParams.getInitialPageSize(), + ModelBridgeInternal.getRequestContinuationFromQueryRequestOptions(initParams.getCosmosQueryRequestOptions())); return Flux.just(context); } catch (CosmosException dce) { 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 30e1d3636e40..e80b277aa4fc 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 @@ -60,37 +60,29 @@ private ParallelDocumentQueryExecutionContext( public static Flux> createAsync( IDocumentQueryClient client, - ResourceType resourceTypeEnum, - Class resourceType, - SqlQuerySpec query, - CosmosQueryRequestOptions cosmosQueryRequestOptions, - String resourceLink, - String collectionRid, - PartitionedQueryExecutionInfo partitionedQueryExecutionInfo, - List targetRanges, - int initialPageSize, - boolean isContinuationExpected, - boolean getLazyFeedResponse, - UUID correlatedActivityId) { - - ParallelDocumentQueryExecutionContext context = new ParallelDocumentQueryExecutionContext(client, - targetRanges, - resourceTypeEnum, - resourceType, - query, - cosmosQueryRequestOptions, - resourceLink, - partitionedQueryExecutionInfo.getQueryInfo().getRewrittenQuery(), - collectionRid, - isContinuationExpected, - getLazyFeedResponse, - correlatedActivityId); + PipelinedDocumentQueryParams initParams) { + + ParallelDocumentQueryExecutionContext context = new ParallelDocumentQueryExecutionContext( + client, + initParams.getPartitionKeyRanges(), + initParams.getResourceTypeEnum(), + initParams.getResourceType(), + initParams.getQuery(), + initParams.getCosmosQueryRequestOptions(), + initParams.getResourceLink(), + initParams.getQueryInfo().getRewrittenQuery(), + initParams.getCollectionRid(), + initParams.isContinuationExpected(), + initParams.isGetLazyResponseFeed(), + initParams.getCorrelatedActivityId()); + context.setTop(initParams.getTop()); try { - context.initialize(collectionRid, - targetRanges, - initialPageSize, - ModelBridgeInternal.getRequestContinuationFromQueryRequestOptions(cosmosQueryRequestOptions)); + context.initialize( + initParams.getCollectionRid(), + initParams.getPartitionKeyRanges(), + initParams.getInitialPageSize(), + ModelBridgeInternal.getRequestContinuationFromQueryRequestOptions(initParams.getCosmosQueryRequestOptions())); return Flux.just(context); } catch (CosmosException dce) { return Flux.error(dce); 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 7be73c08e7bf..1b8269440cfd 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 @@ -2,20 +2,19 @@ // Licensed under the MIT License. package com.azure.cosmos.implementation.query; +import com.azure.cosmos.implementation.PartitionKeyRange; +import com.azure.cosmos.implementation.Resource; +import com.azure.cosmos.implementation.ResourceType; +import com.azure.cosmos.implementation.Utils; import com.azure.cosmos.models.CosmosQueryRequestOptions; import com.azure.cosmos.models.FeedResponse; import com.azure.cosmos.models.ModelBridgeInternal; -import com.azure.cosmos.implementation.Resource; import com.azure.cosmos.models.SqlQuerySpec; -import com.azure.cosmos.implementation.PartitionKeyRange; -import com.azure.cosmos.implementation.ResourceType; -import com.azure.cosmos.implementation.Utils; import reactor.core.publisher.Flux; -import java.util.List; import java.util.Map; import java.util.UUID; -import java.util.function.Function; +import java.util.function.BiFunction; /** * While this class is public, but it is not part of our published public APIs. @@ -46,105 +45,113 @@ private PipelinedDocumentQueryExecutionContext(IDocumentQueryExecutionComponent< } public static Flux> createAsync( - IDocumentQueryClient client, ResourceType resourceTypeEnum, Class resourceType, SqlQuerySpec expression, - CosmosQueryRequestOptions cosmosQueryRequestOptions, String resourceLink, String collectionRid, - PartitionedQueryExecutionInfo partitionedQueryExecutionInfo, List targetRanges, - int initialPageSize, boolean isContinuationExpected, boolean getLazyFeedResponse, - UUID correlatedActivityId) { - // Use nested callback pattern to unwrap the continuation token at each level. - Function>> createBaseComponentFunction; + IDocumentQueryClient client, + PipelinedDocumentQueryParams initParams) { - QueryInfo queryInfo = partitionedQueryExecutionInfo.getQueryInfo(); + // Use nested callback pattern to unwrap the continuation token and query params at each level. + BiFunction, Flux>> createBaseComponentFunction; + + QueryInfo queryInfo = initParams.getQueryInfo(); + UUID correlatedActivityId = initParams.getCorrelatedActivityId(); + CosmosQueryRequestOptions cosmosQueryRequestOptions = initParams.getCosmosQueryRequestOptions(); if (queryInfo.hasOrderBy()) { - createBaseComponentFunction = (continuationToken) -> { + createBaseComponentFunction = (continuationToken, documentQueryParams) -> { CosmosQueryRequestOptions orderByCosmosQueryRequestOptions = ModelBridgeInternal.createQueryRequestOptions(cosmosQueryRequestOptions); ModelBridgeInternal.setQueryRequestOptionsContinuationToken(orderByCosmosQueryRequestOptions, continuationToken); - return OrderByDocumentQueryExecutionContext.createAsync(client, resourceTypeEnum, resourceType, - expression, orderByCosmosQueryRequestOptions, resourceLink, collectionRid, partitionedQueryExecutionInfo, - targetRanges, initialPageSize, isContinuationExpected, getLazyFeedResponse, - correlatedActivityId); + initParams.setCosmosQueryRequestOptions(orderByCosmosQueryRequestOptions); + + return OrderByDocumentQueryExecutionContext.createAsync(client, documentQueryParams); }; } else { - createBaseComponentFunction = (continuationToken) -> { + createBaseComponentFunction = (continuationToken, documentQueryParams) -> { CosmosQueryRequestOptions parallelCosmosQueryRequestOptions = ModelBridgeInternal.createQueryRequestOptions(cosmosQueryRequestOptions); ModelBridgeInternal.setQueryRequestOptionsContinuationToken(parallelCosmosQueryRequestOptions, continuationToken); - return ParallelDocumentQueryExecutionContext.createAsync(client, resourceTypeEnum, resourceType, - expression, parallelCosmosQueryRequestOptions, resourceLink, collectionRid, partitionedQueryExecutionInfo, - targetRanges, initialPageSize, isContinuationExpected, getLazyFeedResponse, - correlatedActivityId); + initParams.setCosmosQueryRequestOptions(parallelCosmosQueryRequestOptions); + + return ParallelDocumentQueryExecutionContext.createAsync(client, documentQueryParams); }; } - Function>> createAggregateComponentFunction; + BiFunction, Flux>> createAggregateComponentFunction; if (queryInfo.hasAggregates() && !queryInfo.hasGroupBy()) { - createAggregateComponentFunction = (continuationToken) -> { - return AggregateDocumentQueryExecutionContext.createAsync(createBaseComponentFunction, - queryInfo.getAggregates(), - queryInfo.getGroupByAliasToAggregateType(), - queryInfo.getGroupByAliases(), - queryInfo.hasSelectValue(), - continuationToken); - }; + createAggregateComponentFunction = + (continuationToken, documentQueryParams) -> + AggregateDocumentQueryExecutionContext.createAsync(createBaseComponentFunction, + queryInfo.getAggregates(), + queryInfo.getGroupByAliasToAggregateType(), + queryInfo.getGroupByAliases(), + queryInfo.hasSelectValue(), + continuationToken, + documentQueryParams); } else { createAggregateComponentFunction = createBaseComponentFunction; } - Function>> createDistinctComponentFunction; + BiFunction, Flux>> createDistinctComponentFunction; if (queryInfo.hasDistinct()) { - createDistinctComponentFunction = (continuationToken) -> { - return DistinctDocumentQueryExecutionContext.createAsync(createAggregateComponentFunction, - queryInfo.getDistinctQueryType(), continuationToken); - }; + createDistinctComponentFunction = + (continuationToken, documentQueryParams) -> + DistinctDocumentQueryExecutionContext.createAsync(createAggregateComponentFunction, + queryInfo.getDistinctQueryType(), + continuationToken, + documentQueryParams); } else { createDistinctComponentFunction = createAggregateComponentFunction; } - Function>> createGroupByComponentFunction; + BiFunction, Flux>> createGroupByComponentFunction; if (queryInfo.hasGroupBy()) { - createGroupByComponentFunction = (continuationToken) -> { - return GroupByDocumentQueryExecutionContext.createAsync(createDistinctComponentFunction, - continuationToken, - queryInfo.getGroupByAliasToAggregateType(), - queryInfo.getGroupByAliases(), - queryInfo.hasSelectValue()); - }; + createGroupByComponentFunction = + (continuationToken, documentQueryParams) -> + GroupByDocumentQueryExecutionContext.createAsync(createDistinctComponentFunction, + continuationToken, + queryInfo.getGroupByAliasToAggregateType(), + queryInfo.getGroupByAliases(), + queryInfo.hasSelectValue(), + documentQueryParams); } else{ createGroupByComponentFunction = createDistinctComponentFunction; } - Function>> createSkipComponentFunction; + BiFunction, Flux>> createSkipComponentFunction; if (queryInfo.hasOffset()) { - createSkipComponentFunction = (continuationToken) -> { - return SkipDocumentQueryExecutionContext.createAsync(createGroupByComponentFunction, - queryInfo.getOffset(), - continuationToken); - }; + createSkipComponentFunction = + (continuationToken, documentQueryParams) -> + SkipDocumentQueryExecutionContext.createAsync(createGroupByComponentFunction, + queryInfo.getOffset(), + continuationToken, + documentQueryParams); } else { createSkipComponentFunction = createGroupByComponentFunction; } - Function>> createTopComponentFunction; + BiFunction, Flux>> createTopComponentFunction; if (queryInfo.hasTop()) { - createTopComponentFunction = (continuationToken) -> { - return TopDocumentQueryExecutionContext.createAsync(createSkipComponentFunction, - queryInfo.getTop(), queryInfo.getTop(), continuationToken); - }; + createTopComponentFunction = + (continuationToken, documentQueryParams) -> + TopDocumentQueryExecutionContext.createAsync(createSkipComponentFunction, + queryInfo.getTop(), + queryInfo.getTop(), + continuationToken, + documentQueryParams); } else { createTopComponentFunction = createSkipComponentFunction; } - Function>> createTakeComponentFunction; + BiFunction, Flux>> createTakeComponentFunction; if (queryInfo.hasLimit()) { - createTakeComponentFunction = (continuationToken) -> { + createTakeComponentFunction = (continuationToken, documentQueryParams) -> { int totalLimit = queryInfo.getLimit(); if (queryInfo.hasOffset()) { // This is being done to match the limit from rewritten query totalLimit = queryInfo.getOffset() + queryInfo.getLimit(); } return TopDocumentQueryExecutionContext.createAsync(createTopComponentFunction, - queryInfo.getLimit(), totalLimit, - continuationToken); + queryInfo.getLimit(), + totalLimit, + continuationToken, + documentQueryParams); }; } else { createTakeComponentFunction = createTopComponentFunction; @@ -158,7 +165,7 @@ public static Flux new PipelinedDocumentQueryExecutionContext<>(c, pageSize, correlatedActivityId, queryInfo)); } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryParams.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryParams.java new file mode 100644 index 000000000000..f9b256d5482a --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryParams.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.cosmos.implementation.query; + +import com.azure.cosmos.implementation.PartitionKeyRange; +import com.azure.cosmos.implementation.Resource; +import com.azure.cosmos.implementation.ResourceType; +import com.azure.cosmos.models.CosmosQueryRequestOptions; +import com.azure.cosmos.models.SqlQuerySpec; + +import java.util.List; +import java.util.UUID; + +public class PipelinedDocumentQueryParams { + private int top = -1; + private final int initialPageSize; + private final boolean isContinuationExpected; + private final boolean getLazyResponseFeed; + private final String collectionRid; + private final ResourceType resourceTypeEnum; + private final Class resourceType; + private final SqlQuerySpec query; + private final String resourceLink; + private final UUID correlatedActivityId; + private CosmosQueryRequestOptions cosmosQueryRequestOptions; + private final List partitionKeyRanges; + private final QueryInfo queryInfo; + + public PipelinedDocumentQueryParams( + ResourceType resourceTypeEnum, + Class resourceType, + SqlQuerySpec query, + String resourceLink, + String collectionRid, + boolean getLazyResponseFeed, + boolean isContinuationExpected, + int initialPageSize, + List partitionKeyRanges, + QueryInfo queryInfo, + CosmosQueryRequestOptions cosmosQueryRequestOptions, + UUID correlatedActivityId) { + + this.resourceTypeEnum = resourceTypeEnum; + this.resourceType = resourceType; + this.query = query; + this.resourceLink = resourceLink; + this.collectionRid = collectionRid; + this.getLazyResponseFeed = getLazyResponseFeed; + this.isContinuationExpected = isContinuationExpected; + this.initialPageSize = initialPageSize; + this.correlatedActivityId = correlatedActivityId; + this.partitionKeyRanges = partitionKeyRanges; + this.queryInfo = queryInfo; + this.cosmosQueryRequestOptions = cosmosQueryRequestOptions; + } + + public int getTop() { + return top; + } + + public void setTop(int top) { + this.top = top; + } + + public int getInitialPageSize() { + return initialPageSize; + } + + public boolean isContinuationExpected() { + return isContinuationExpected; + } + + public boolean isGetLazyResponseFeed() { + return getLazyResponseFeed; + } + + public String getCollectionRid() { + return collectionRid; + } + + public ResourceType getResourceTypeEnum() { + return resourceTypeEnum; + } + + public Class getResourceType() { + return resourceType; + } + + public SqlQuerySpec getQuery() { + return query; + } + + public String getResourceLink() { + return resourceLink; + } + + public UUID getCorrelatedActivityId() { + return correlatedActivityId; + } + + public CosmosQueryRequestOptions getCosmosQueryRequestOptions() { + return cosmosQueryRequestOptions; + } + + public void setCosmosQueryRequestOptions(CosmosQueryRequestOptions cosmosQueryRequestOptions) { + this.cosmosQueryRequestOptions = cosmosQueryRequestOptions; + } + + public List getPartitionKeyRanges() { + return partitionKeyRanges; + } + + public QueryInfo getQueryInfo() { + return queryInfo; + } +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/SkipDocumentQueryExecutionContext.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/SkipDocumentQueryExecutionContext.java index 0c4e559d17de..741a20cd64e3 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/SkipDocumentQueryExecutionContext.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/SkipDocumentQueryExecutionContext.java @@ -14,7 +14,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.function.Function; +import java.util.function.BiFunction; import java.util.stream.Collectors; public final class SkipDocumentQueryExecutionContext implements IDocumentQueryExecutionComponent { @@ -31,9 +31,10 @@ public final class SkipDocumentQueryExecutionContext impleme } public static Flux> createAsync( - Function>> createSourceComponentFunction, + BiFunction, Flux>> createSourceComponentFunction, int skipCount, - String continuationToken) { + String continuationToken, + PipelinedDocumentQueryParams documentQueryParams) { OffsetContinuationToken offsetContinuationToken; Utils.ValueHolder outOffsetContinuationToken = new Utils.ValueHolder<>(); if (continuationToken != null) { @@ -51,7 +52,7 @@ public static Flux> cre offsetContinuationToken = new OffsetContinuationToken(skipCount, null); } - return createSourceComponentFunction.apply(offsetContinuationToken.getSourceToken()) + return createSourceComponentFunction.apply(offsetContinuationToken.getSourceToken(), documentQueryParams) .map(component -> new SkipDocumentQueryExecutionContext<>(component, offsetContinuationToken.getOffset())); } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/TopDocumentQueryExecutionContext.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/TopDocumentQueryExecutionContext.java index 43ca0baafa44..e3a61abe7474 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/TopDocumentQueryExecutionContext.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/TopDocumentQueryExecutionContext.java @@ -13,6 +13,7 @@ import java.util.HashMap; import java.util.Map; +import java.util.function.BiFunction; import java.util.function.Function; import java.util.function.Predicate; @@ -30,8 +31,11 @@ public TopDocumentQueryExecutionContext(IDocumentQueryExecutionComponent comp } public static Flux> createAsync( - Function>> createSourceComponentFunction, - int topCount, int limit, String topContinuationToken) { + BiFunction, Flux>> createSourceComponentFunction, + int topCount, + int limit, + String topContinuationToken, + PipelinedDocumentQueryParams documentQueryParams) { TakeContinuationToken takeContinuationToken; if (topContinuationToken == null) { @@ -57,19 +61,17 @@ public static Flux> cre return Flux.error(dce); } + // The top value setting here will be propagated down to document producer. + documentQueryParams.setTop(limit); + return createSourceComponentFunction - .apply(takeContinuationToken.getSourceToken()) + .apply(takeContinuationToken.getSourceToken(), documentQueryParams) .map(component -> new TopDocumentQueryExecutionContext<>(component, takeContinuationToken.getTakeCount(), limit)); } @Override public Flux> drainAsync(int maxPageSize) { - ParallelDocumentQueryExecutionContextBase context; - // These checks below are getting messier. Needs redesign - context = getContextFromComponent(); - - context.setTop(this.limit); return this.component.drainAsync(maxPageSize).takeUntil(new Predicate>() { @@ -124,45 +126,4 @@ public FeedResponse apply(FeedResponse t) { } }); } - - // TODO: This could be restructured eventually with better design to avoid these many checks - private ParallelDocumentQueryExecutionContextBase getContextFromComponent() { - ParallelDocumentQueryExecutionContextBase context; - if (this.component instanceof GroupByDocumentQueryExecutionContext) { - context = - (ParallelDocumentQueryExecutionContextBase) ((GroupByDocumentQueryExecutionContext) this.component) - .getComponent(); - } else if (this.component instanceof DistinctDocumentQueryExecutionContext) { - context = - (ParallelDocumentQueryExecutionContextBase) ((DistinctDocumentQueryExecutionContext) this.component) - .getComponent(); - } else if (this.component instanceof AggregateDocumentQueryExecutionContext) { - context = - (ParallelDocumentQueryExecutionContextBase) ((AggregateDocumentQueryExecutionContext) this.component) - .getComponent(); - } else if (this.component instanceof SkipDocumentQueryExecutionContext) { - - IDocumentQueryExecutionComponent component = ((SkipDocumentQueryExecutionContext) this.component) - .getComponent(); - if (component instanceof DistinctDocumentQueryExecutionContext) { - context = - (ParallelDocumentQueryExecutionContextBase) ((DistinctDocumentQueryExecutionContext) component) - .getComponent(); - } else if (component instanceof AggregateDocumentQueryExecutionContext) { - context = - (ParallelDocumentQueryExecutionContextBase) ((AggregateDocumentQueryExecutionContext) component) - .getComponent(); - } else if (component instanceof GroupByDocumentQueryExecutionContext) { - context = - (ParallelDocumentQueryExecutionContextBase) ((GroupByDocumentQueryExecutionContext) component) - .getComponent(); - } else { - context = - (ParallelDocumentQueryExecutionContextBase) component; - } - } else { - context = (ParallelDocumentQueryExecutionContextBase) this.component; - } - return context; - } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosStoredProcedureRequestOptions.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosStoredProcedureRequestOptions.java index b68fe54ff873..23d680ebfca8 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosStoredProcedureRequestOptions.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosStoredProcedureRequestOptions.java @@ -14,6 +14,7 @@ public final class CosmosStoredProcedureRequestOptions { private String sessionToken; private String ifMatchETag; private String ifNoneMatchETag; + private boolean scriptLoggingEnabled; /** * Gets the If-Match (ETag) associated with the request in the Azure Cosmos DB service. @@ -115,6 +116,32 @@ public CosmosStoredProcedureRequestOptions setSessionToken(String sessionToken) return this; } + /** + * Gets whether Javascript stored procedure logging is enabled for the current request in the Azure Cosmos DB database + * service or not. + * + * Default value is false + * + * @return true if Javascript stored procedure logging is enabled + */ + public boolean isScriptLoggingEnabled() { + return scriptLoggingEnabled; + } + + /** + * Sets whether Javascript stored procedure logging is enabled for the current request in the Azure Cosmos DB database + * service or not. + * + * Default value is false + * + * @param scriptLoggingEnabled true if stored procedure Javascript logging is enabled + * @return the CosmosStoredProcedureRequestOptions. + */ + public CosmosStoredProcedureRequestOptions setScriptLoggingEnabled(boolean scriptLoggingEnabled) { + this.scriptLoggingEnabled = scriptLoggingEnabled; + return this; + } + RequestOptions toRequestOptions() { RequestOptions requestOptions = new RequestOptions(); requestOptions.setIfMatchETag(getIfMatchETag()); @@ -122,6 +149,7 @@ RequestOptions toRequestOptions() { requestOptions.setConsistencyLevel(getConsistencyLevel()); requestOptions.setPartitionKey(partitionKey); requestOptions.setSessionToken(sessionToken); + requestOptions.setScriptLoggingEnabled(scriptLoggingEnabled); return requestOptions; } } diff --git a/sdk/cosmos/azure-cosmos/src/samples/java/com/azure/cosmos/ChangeFeedProcessorCodeSnippet.java b/sdk/cosmos/azure-cosmos/src/samples/java/com/azure/cosmos/ChangeFeedProcessorCodeSnippet.java index 1e1d7a923467..24b3e2fec460 100644 --- a/sdk/cosmos/azure-cosmos/src/samples/java/com/azure/cosmos/ChangeFeedProcessorCodeSnippet.java +++ b/sdk/cosmos/azure-cosmos/src/samples/java/com/azure/cosmos/ChangeFeedProcessorCodeSnippet.java @@ -2,6 +2,7 @@ // Licensed under the MIT License. package com.azure.cosmos; +import com.azure.cosmos.implementation.TestConfigurations; import com.fasterxml.jackson.databind.JsonNode; /** @@ -11,7 +12,12 @@ public class ChangeFeedProcessorCodeSnippet { public void changeFeedProcessorBuilderCodeSnippet() { String hostName = "test-host-name"; - CosmosAsyncClient cosmosAsyncClient = new CosmosClientBuilder().buildAsyncClient(); + 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"); @@ -31,7 +37,12 @@ public void changeFeedProcessorBuilderCodeSnippet() { public void handleChangesCodeSnippet() { String hostName = "test-host-name"; - CosmosAsyncClient cosmosAsyncClient = new CosmosClientBuilder().buildAsyncClient(); + 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"); diff --git a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/AzureKeyCredentialTest.java b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/AzureKeyCredentialTest.java index 9e161fe0662e..e8c80957fa06 100644 --- a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/AzureKeyCredentialTest.java +++ b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/AzureKeyCredentialTest.java @@ -1,25 +1,24 @@ package com.azure.cosmos; -import com.azure.cosmos.implementation.InternalObjectNode; import com.azure.cosmos.implementation.FailureValidator; +import com.azure.cosmos.implementation.InternalObjectNode; import com.azure.cosmos.implementation.RetryAnalyzer; -import com.azure.cosmos.models.CosmosContainerResponse; -import com.azure.cosmos.models.CosmosDatabaseResponse; -import com.azure.cosmos.models.CosmosItemResponse; +import com.azure.cosmos.implementation.TestConfigurations; import com.azure.cosmos.models.CosmosContainerProperties; import com.azure.cosmos.models.CosmosContainerRequestOptions; +import com.azure.cosmos.models.CosmosContainerResponse; import com.azure.cosmos.models.CosmosDatabaseProperties; import com.azure.cosmos.models.CosmosDatabaseRequestOptions; +import com.azure.cosmos.models.CosmosDatabaseResponse; import com.azure.cosmos.models.CosmosItemRequestOptions; +import com.azure.cosmos.models.CosmosItemResponse; import com.azure.cosmos.models.CosmosResponse; import com.azure.cosmos.models.IndexingMode; import com.azure.cosmos.models.IndexingPolicy; import com.azure.cosmos.models.ModelBridgeInternal; import com.azure.cosmos.models.PartitionKey; -import com.azure.cosmos.models.PartitionKeyDefinition; import com.azure.cosmos.rx.CosmosItemResponseValidator; import com.azure.cosmos.rx.TestSuiteBase; -import com.azure.cosmos.implementation.TestConfigurations; import org.testng.annotations.AfterClass; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeClass; @@ -65,17 +64,6 @@ public Object[][] crudArgProvider() { }; } - private CosmosContainerProperties getCollectionDefinition(String collectionName) { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList<>(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - - return new CosmosContainerProperties( - collectionName, - partitionKeyDef); - } - private InternalObjectNode getDocumentDefinition(String documentId) { final String uuid = UUID.randomUUID().toString(); return new InternalObjectNode(String.format("{ " diff --git a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/ConnectionConfigTest.java b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/ConnectionConfigTest.java index cf0dc55b925a..a7a01d1f68ee 100644 --- a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/ConnectionConfigTest.java +++ b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/ConnectionConfigTest.java @@ -12,7 +12,6 @@ import java.time.Duration; import java.util.ArrayList; import java.util.List; -import java.util.Objects; import static org.assertj.core.api.Assertions.assertThat; @@ -37,7 +36,7 @@ public void buildClient_withDefaultGatewayConnectionConfig() { AsyncDocumentClient asyncDocumentClient = CosmosBridgeInternal.getAsyncDocumentClient(cosmosClient); ConnectionPolicy connectionPolicy = asyncDocumentClient.getConnectionPolicy(); - assertThat(connectionPolicy.getConnectionMode().equals(ConnectionMode.GATEWAY)); + assertThat(connectionPolicy.getConnectionMode()).isEqualTo(ConnectionMode.GATEWAY); validateGatewayConnectionConfig(connectionPolicy, cosmosClientBuilder, gatewayConnectionConfig); safeCloseSyncClient(cosmosClient); } @@ -66,7 +65,7 @@ public void buildClient_withCustomGatewayConnectionConfig() { AsyncDocumentClient asyncDocumentClient = CosmosBridgeInternal.getAsyncDocumentClient(cosmosClient); ConnectionPolicy connectionPolicy = asyncDocumentClient.getConnectionPolicy(); - assertThat(connectionPolicy.getConnectionMode().equals(ConnectionMode.GATEWAY)); + assertThat(connectionPolicy.getConnectionMode()).isEqualTo(ConnectionMode.GATEWAY); validateGatewayConnectionConfig(connectionPolicy, cosmosClientBuilder, gatewayConnectionConfig); safeCloseSyncClient(cosmosClient); } @@ -84,7 +83,7 @@ public void buildClient_withDefaultDirectConnectionConfig() { AsyncDocumentClient asyncDocumentClient = CosmosBridgeInternal.getAsyncDocumentClient(cosmosClient); ConnectionPolicy connectionPolicy = asyncDocumentClient.getConnectionPolicy(); - assertThat(connectionPolicy.getConnectionMode().equals(ConnectionMode.DIRECT)); + assertThat(connectionPolicy.getConnectionMode()).isEqualTo(ConnectionMode.DIRECT); validateDirectConnectionConfig(connectionPolicy, cosmosClientBuilder, directConnectionConfig); safeCloseSyncClient(cosmosClient); } @@ -113,7 +112,7 @@ public void buildClient_withCustomDirectConnectionConfig() { AsyncDocumentClient asyncDocumentClient = CosmosBridgeInternal.getAsyncDocumentClient(cosmosClient); ConnectionPolicy connectionPolicy = asyncDocumentClient.getConnectionPolicy(); - assertThat(connectionPolicy.getConnectionMode().equals(ConnectionMode.DIRECT)); + assertThat(connectionPolicy.getConnectionMode()).isEqualTo(ConnectionMode.DIRECT); validateDirectConnectionConfig(connectionPolicy, cosmosClientBuilder, directConnectionConfig); safeCloseSyncClient(cosmosClient); } @@ -133,7 +132,7 @@ public void buildClient_withDirectAndGatewayConnectionConfig() { AsyncDocumentClient asyncDocumentClient = CosmosBridgeInternal.getAsyncDocumentClient(cosmosClient); ConnectionPolicy connectionPolicy = asyncDocumentClient.getConnectionPolicy(); - assertThat(connectionPolicy.getConnectionMode().equals(ConnectionMode.DIRECT)); + assertThat(connectionPolicy.getConnectionMode()).isEqualTo(ConnectionMode.DIRECT); validateDirectAndGatewayConnectionConfig(connectionPolicy, cosmosClientBuilder, directConnectionConfig, gatewayConnectionConfig); safeCloseSyncClient(cosmosClient); } @@ -149,7 +148,7 @@ public void buildClient_withNoConnectionConfig() { AsyncDocumentClient asyncDocumentClient = CosmosBridgeInternal.getAsyncDocumentClient(cosmosClient); ConnectionPolicy connectionPolicy = asyncDocumentClient.getConnectionPolicy(); - assertThat(connectionPolicy.getConnectionMode().equals(ConnectionMode.DIRECT)); + assertThat(connectionPolicy.getConnectionMode()).isEqualTo(ConnectionMode.DIRECT); validateDirectConnectionConfig(connectionPolicy, cosmosClientBuilder, DirectConnectionConfig.getDefaultConfig()); safeCloseSyncClient(cosmosClient); } @@ -157,44 +156,44 @@ public void buildClient_withNoConnectionConfig() { private void validateDirectAndGatewayConnectionConfig(ConnectionPolicy connectionPolicy, CosmosClientBuilder cosmosClientBuilder, DirectConnectionConfig directConnectionConfig, GatewayConnectionConfig gatewayConnectionConfig) { validateCommonConnectionConfig(connectionPolicy, cosmosClientBuilder); - assertThat(Objects.equals(connectionPolicy.getConnectionMode(), ConnectionMode.DIRECT)); + assertThat(connectionPolicy.getConnectionMode()).isEqualTo(ConnectionMode.DIRECT); validateDirectConfig(connectionPolicy, directConnectionConfig); validateGatewayConfig(connectionPolicy, gatewayConnectionConfig); } private void validateGatewayConnectionConfig(ConnectionPolicy connectionPolicy, CosmosClientBuilder cosmosClientBuilder, GatewayConnectionConfig gatewayConnectionConfig) { validateCommonConnectionConfig(connectionPolicy, cosmosClientBuilder); - assertThat(Objects.equals(connectionPolicy.getConnectionMode(), ConnectionMode.GATEWAY)); + assertThat(connectionPolicy.getConnectionMode()).isEqualTo(ConnectionMode.GATEWAY); validateGatewayConfig(connectionPolicy, gatewayConnectionConfig); } private void validateDirectConnectionConfig(ConnectionPolicy connectionPolicy, CosmosClientBuilder cosmosClientBuilder, DirectConnectionConfig directConnectionConfig) { validateCommonConnectionConfig(connectionPolicy, cosmosClientBuilder); - assertThat(Objects.equals(connectionPolicy.getConnectionMode(), ConnectionMode.DIRECT)); + assertThat(connectionPolicy.getConnectionMode()).isEqualTo(ConnectionMode.DIRECT); validateDirectConfig(connectionPolicy, directConnectionConfig); } private void validateCommonConnectionConfig(ConnectionPolicy connectionPolicy, CosmosClientBuilder cosmosClientBuilder) { - assertThat(Objects.equals(connectionPolicy.isMultipleWriteRegionsEnabled(), cosmosClientBuilder.isMultipleWriteRegionsEnabled())); - assertThat(Objects.equals(connectionPolicy.isEndpointDiscoveryEnabled(), cosmosClientBuilder.isEndpointDiscoveryEnabled())); - assertThat(Objects.equals(connectionPolicy.isReadRequestsFallbackEnabled(), cosmosClientBuilder.isReadRequestsFallbackEnabled())); - assertThat(Objects.equals(connectionPolicy.getPreferredRegions(), cosmosClientBuilder.getPreferredRegions())); - assertThat(Objects.equals(connectionPolicy.getThrottlingRetryOptions(), cosmosClientBuilder.getThrottlingRetryOptions())); - assertThat(Objects.equals(connectionPolicy.getUserAgentSuffix(), cosmosClientBuilder.getUserAgentSuffix())); + assertThat(connectionPolicy.isMultipleWriteRegionsEnabled()).isEqualTo(cosmosClientBuilder.isMultipleWriteRegionsEnabled()); + assertThat(connectionPolicy.isEndpointDiscoveryEnabled()).isEqualTo(cosmosClientBuilder.isEndpointDiscoveryEnabled()); + assertThat(connectionPolicy.isReadRequestsFallbackEnabled()).isEqualTo(cosmosClientBuilder.isReadRequestsFallbackEnabled()); + assertThat(connectionPolicy.getPreferredRegions()).isEqualTo(cosmosClientBuilder.getPreferredRegions()); + assertThat(connectionPolicy.getThrottlingRetryOptions()).isEqualTo(cosmosClientBuilder.getThrottlingRetryOptions()); + assertThat(connectionPolicy.getUserAgentSuffix()).isEqualTo(cosmosClientBuilder.getUserAgentSuffix()); } private void validateGatewayConfig(ConnectionPolicy connectionPolicy, GatewayConnectionConfig gatewayConnectionConfig) { - assertThat(Objects.equals(connectionPolicy.getIdleConnectionTimeout(), gatewayConnectionConfig.getIdleConnectionTimeout())); - assertThat(Objects.equals(connectionPolicy.getMaxConnectionPoolSize(), gatewayConnectionConfig.getMaxConnectionPoolSize())); - assertThat(Objects.equals(connectionPolicy.getRequestTimeout(), gatewayConnectionConfig.getRequestTimeout())); - assertThat(Objects.equals(connectionPolicy.getProxy(), gatewayConnectionConfig.getProxy())); + assertThat(connectionPolicy.getIdleHttpConnectionTimeout()).isEqualTo(gatewayConnectionConfig.getIdleConnectionTimeout()); + assertThat(connectionPolicy.getMaxConnectionPoolSize()).isEqualTo(gatewayConnectionConfig.getMaxConnectionPoolSize()); + assertThat(connectionPolicy.getRequestTimeout()).isEqualTo(gatewayConnectionConfig.getRequestTimeout()); + assertThat(connectionPolicy.getProxy()).isEqualTo(gatewayConnectionConfig.getProxy()); } private void validateDirectConfig(ConnectionPolicy connectionPolicy, DirectConnectionConfig directConnectionConfig) { - assertThat(Objects.equals(connectionPolicy.getConnectTimeout(), directConnectionConfig.getConnectTimeout())); - assertThat(Objects.equals(connectionPolicy.getIdleConnectionTimeout(), directConnectionConfig.getIdleConnectionTimeout())); - assertThat(Objects.equals(connectionPolicy.getIdleEndpointTimeout(), directConnectionConfig.getIdleEndpointTimeout())); - assertThat(Objects.equals(connectionPolicy.getMaxConnectionsPerEndpoint(), directConnectionConfig.getMaxConnectionsPerEndpoint())); - assertThat(Objects.equals(connectionPolicy.getMaxRequestsPerConnection(), directConnectionConfig.getMaxRequestsPerConnection())); + assertThat(connectionPolicy.getConnectTimeout()).isEqualTo(directConnectionConfig.getConnectTimeout()); + assertThat(connectionPolicy.getIdleTcpConnectionTimeout()).isEqualTo(directConnectionConfig.getIdleConnectionTimeout()); + assertThat(connectionPolicy.getIdleEndpointTimeout()).isEqualTo(directConnectionConfig.getIdleEndpointTimeout()); + assertThat(connectionPolicy.getMaxConnectionsPerEndpoint()).isEqualTo(directConnectionConfig.getMaxConnectionsPerEndpoint()); + assertThat(connectionPolicy.getMaxRequestsPerConnection()).isEqualTo(directConnectionConfig.getMaxRequestsPerConnection()); } } diff --git a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosContainerContentResponseOnWriteTest.java b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosContainerContentResponseOnWriteTest.java index efaab4cdf95f..c9c473d7ae75 100644 --- a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosContainerContentResponseOnWriteTest.java +++ b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosContainerContentResponseOnWriteTest.java @@ -11,14 +11,12 @@ import com.azure.cosmos.models.CosmosContainerResponse; import com.azure.cosmos.models.IndexingMode; import com.azure.cosmos.models.IndexingPolicy; -import com.azure.cosmos.models.PartitionKeyDefinition; import com.azure.cosmos.rx.TestSuiteBase; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Factory; import org.testng.annotations.Test; -import java.util.ArrayList; import java.util.UUID; import static org.assertj.core.api.Assertions.assertThat; @@ -102,17 +100,6 @@ public void replaceContainer_withContentResponseOnWriteDisabled() throws Excepti } - private CosmosContainerProperties getCollectionDefinition(String collectionName) { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - - return new CosmosContainerProperties( - collectionName, - partitionKeyDef); - } - private void validateContainerResponse(CosmosContainerProperties containerProperties, CosmosContainerResponse createResponse) { // Basic validation diff --git a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosContainerTest.java b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosContainerTest.java index 65970732ce53..39c7f7f9d129 100644 --- a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosContainerTest.java +++ b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosContainerTest.java @@ -6,17 +6,16 @@ package com.azure.cosmos; +import com.azure.cosmos.implementation.HttpConstants; import com.azure.cosmos.models.CosmosContainerProperties; import com.azure.cosmos.models.CosmosContainerRequestOptions; import com.azure.cosmos.models.CosmosContainerResponse; import com.azure.cosmos.models.CosmosQueryRequestOptions; import com.azure.cosmos.models.IndexingMode; import com.azure.cosmos.models.IndexingPolicy; -import com.azure.cosmos.models.PartitionKeyDefinition; import com.azure.cosmos.models.SqlQuerySpec; import com.azure.cosmos.models.ThroughputProperties; import com.azure.cosmos.rx.TestSuiteBase; -import com.azure.cosmos.implementation.HttpConstants; import com.azure.cosmos.util.CosmosPagedIterable; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; @@ -24,7 +23,6 @@ import org.testng.annotations.Factory; import org.testng.annotations.Test; -import java.util.ArrayList; import java.util.UUID; import static org.assertj.core.api.Assertions.assertThat; @@ -53,19 +51,6 @@ public void afterClass() { safeCloseSyncClient(client); } - private CosmosContainerProperties getCollectionDefinition(String collectionName) { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - - CosmosContainerProperties collectionDefinition = new CosmosContainerProperties( - collectionName, - partitionKeyDef); - - return collectionDefinition; - } - @Test(groups = { "emulator" }, timeOut = TIMEOUT) public void createContainer_withProperties() throws Exception { String collectionName = UUID.randomUUID().toString(); diff --git a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosItemContentResponseOnWriteTest.java b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosItemContentResponseOnWriteTest.java index 767d96aafc4c..e4d0b96e2174 100644 --- a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosItemContentResponseOnWriteTest.java +++ b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosItemContentResponseOnWriteTest.java @@ -7,19 +7,16 @@ package com.azure.cosmos; import com.azure.cosmos.implementation.InternalObjectNode; -import com.azure.cosmos.models.CosmosContainerProperties; import com.azure.cosmos.models.CosmosItemRequestOptions; import com.azure.cosmos.models.CosmosItemResponse; import com.azure.cosmos.models.ModelBridgeInternal; import com.azure.cosmos.models.PartitionKey; -import com.azure.cosmos.models.PartitionKeyDefinition; import com.azure.cosmos.rx.TestSuiteBase; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Factory; import org.testng.annotations.Test; -import java.util.ArrayList; import java.util.UUID; import static org.assertj.core.api.Assertions.assertThat; @@ -106,17 +103,6 @@ public void deleteItem_withContentResponseOnWriteDisabled() throws Exception { validateMinimalItemResponse(properties, deleteResponse, false); } - private CosmosContainerProperties getCollectionDefinition(String collectionName) { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - - return new CosmosContainerProperties( - collectionName, - partitionKeyDef); - } - private InternalObjectNode getDocumentDefinition(String documentId) { final String uuid = UUID.randomUUID().toString(); final InternalObjectNode properties = diff --git a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosSyncStoredProcTest.java b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosSyncStoredProcTest.java index b05aeeea486e..f4d84f3e3a6a 100644 --- a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosSyncStoredProcTest.java +++ b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosSyncStoredProcTest.java @@ -17,6 +17,8 @@ import org.testng.annotations.Factory; import org.testng.annotations.Test; +import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.UUID; @@ -148,19 +150,59 @@ public void deleteStoredProcedure() throws Exception { } @Test(groups = {"simple"}, timeOut = TIMEOUT) public void executeStoredProcedure() throws Exception { - CosmosStoredProcedureProperties sproc = new CosmosStoredProcedureProperties( + CosmosStoredProcedureProperties storedProcedure = new CosmosStoredProcedureProperties( UUID.randomUUID().toString(), - "function() {var x = 10;}" - ); - - CosmosStoredProcedureResponse response = container.getScripts().createStoredProcedure(sproc); + "function() {" + + " var mytext = \"x\";" + + " var myval = 1;" + + " try {" + + " console.log(\"The value of %s is %s.\", mytext, myval);" + + " getContext().getResponse().setBody(\"Success!\");" + + " }" + + " catch(err) {" + + " getContext().getResponse().setBody(\"inline err: [\" + err.number + \"] \" + err);" + + " }" + + "}"); + + container.getScripts().createStoredProcedure(storedProcedure); CosmosStoredProcedureRequestOptions options = new CosmosStoredProcedureRequestOptions(); options.setPartitionKey(PartitionKey.NONE); CosmosStoredProcedureResponse executeResponse = container.getScripts() - .getStoredProcedure(sproc.getId()) + .getStoredProcedure(storedProcedure.getId()) .execute(null, options); assertThat(executeResponse.getActivityId()).isNotEmpty(); + assertThat(executeResponse.getScriptLog()).isNull(); + } + + @Test(groups = "simple", timeOut = TIMEOUT) + public void executeStoredProcedureWithScriptLoggingEnabled() throws Exception { + // Create a stored procedure + CosmosStoredProcedureProperties storedProcedure = new CosmosStoredProcedureProperties( + UUID.randomUUID().toString(), + "function() {" + + " var mytext = \"x\";" + + " var myval = 1;" + + " try {" + + " console.log(\"The value of %s is %s.\", mytext, myval);" + + " getContext().getResponse().setBody(\"Success!\");" + + " }" + + " catch(err) {" + + " getContext().getResponse().setBody(\"inline err: [\" + err.number + \"] \" + err);" + + " }" + + "}"); + + container.getScripts().createStoredProcedure(storedProcedure); + CosmosStoredProcedureRequestOptions options = new CosmosStoredProcedureRequestOptions(); + options.setScriptLoggingEnabled(true); + options.setPartitionKey(PartitionKey.NONE); + + CosmosStoredProcedureResponse executeResponse = container.getScripts() + .getStoredProcedure(storedProcedure.getId()) + .execute(null, options); + + String logResult = "The value of x is 1."; + assertThat(executeResponse.getScriptLog()).isEqualTo(logResult); } @Test(groups = {"simple"}, timeOut = TIMEOUT) diff --git a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/models/CosmosPartitionKeyTests.java b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/models/CosmosPartitionKeyTests.java index 58f2ea67d7fe..87c6c943a1fe 100644 --- a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/models/CosmosPartitionKeyTests.java +++ b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/models/CosmosPartitionKeyTests.java @@ -78,7 +78,7 @@ public void afterClass() { private void createContainerWithoutPk() throws URISyntaxException, IOException { ConnectionPolicy connectionPolicy = new ConnectionPolicy(DirectConnectionConfig.getDefaultConfig()); HttpClientConfig httpClientConfig = new HttpClientConfig(new Configs()) - .withMaxIdleConnectionTimeout(connectionPolicy.getIdleConnectionTimeout()) + .withMaxIdleConnectionTimeout(connectionPolicy.getIdleHttpConnectionTimeout()) .withPoolSize(connectionPolicy.getMaxConnectionPoolSize()) .withProxy(connectionPolicy.getProxy()) .withRequestTimeout(connectionPolicy.getRequestTimeout()); diff --git a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/CollectionCrudTest.java b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/CollectionCrudTest.java index f2d660ce53ca..1b05b05355b7 100644 --- a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/CollectionCrudTest.java +++ b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/CollectionCrudTest.java @@ -70,19 +70,6 @@ public Object[][] collectionCrudArgProvider() { }; } - private CosmosContainerProperties getCollectionDefinition(String collectionName) { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - - CosmosContainerProperties collectionDefinition = new CosmosContainerProperties( - collectionName, - partitionKeyDef); - - return collectionDefinition; - } - @Test(groups = { "emulator" }, timeOut = TIMEOUT, dataProvider = "collectionCrudArgProvider") public void createCollection(String collectionName) throws InterruptedException { CosmosContainerProperties collectionDefinition = getCollectionDefinition(collectionName); diff --git a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/ContainerCreateDeleteWithSameNameTest.java b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/ContainerCreateDeleteWithSameNameTest.java new file mode 100644 index 000000000000..24380fcdb4f3 --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/ContainerCreateDeleteWithSameNameTest.java @@ -0,0 +1,354 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.cosmos.rx; + +import com.azure.cosmos.ChangeFeedProcessor; +import com.azure.cosmos.ChangeFeedProcessorBuilder; +import com.azure.cosmos.CosmosAsyncClient; +import com.azure.cosmos.CosmosAsyncContainer; +import com.azure.cosmos.CosmosAsyncDatabase; +import com.azure.cosmos.CosmosClientBuilder; +import com.azure.cosmos.implementation.FeedResponseListValidator; +import com.azure.cosmos.implementation.Utils; +import com.azure.cosmos.models.ChangeFeedProcessorOptions; +import com.azure.cosmos.models.CosmosContainerProperties; +import com.azure.cosmos.models.CosmosContainerRequestOptions; +import com.azure.cosmos.models.CosmosItemRequestOptions; +import com.azure.cosmos.models.CosmosItemResponse; +import com.azure.cosmos.models.CosmosQueryRequestOptions; +import com.azure.cosmos.models.PartitionKey; +import com.azure.cosmos.util.CosmosPagedFlux; +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.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Factory; +import org.testng.annotations.Test; +import reactor.core.publisher.Mono; +import reactor.core.scheduler.Schedulers; + +import java.time.Duration; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.BiConsumer; +import java.util.function.Consumer; + +import static org.assertj.core.api.Assertions.assertThat; + +public class ContainerCreateDeleteWithSameNameTest extends TestSuiteBase { + private final static int TIMEOUT = 300000; + // Delete collections in emulator is not instant, + // so to avoid get 500 back, we are adding delay for creating the collection with same name, since in this case we want to test 410/1000 + private final static int COLLECTION_RECREATION_TIME_DELAY = 2000; + private CosmosAsyncClient client; + private CosmosAsyncDatabase createdDatabase; + + @Factory(dataProvider = "clientBuildersWithSessionConsistency") + public ContainerCreateDeleteWithSameNameTest(CosmosClientBuilder clientBuilder) { + super(clientBuilder); + this.subscriberValidationTimeout = TIMEOUT; + } + + @Test(groups = {"emulator"}, timeOut = TIMEOUT) + public void query() throws Exception { + String query = "SELECT * FROM r"; + + Consumer func = (container) -> { + TestObject docDefinition = getDocumentDefinition(); + container.createItem(docDefinition).block(); + + CosmosQueryRequestOptions requestOptions = new CosmosQueryRequestOptions(); + CosmosPagedFlux queryFlux = container.queryItems(query, requestOptions, TestObject.class); + FeedResponseListValidator queryValidator = new FeedResponseListValidator.Builder() + .totalSize(1) + .numberOfPages(1) + .build(); + validateQuerySuccess(queryFlux.byPage(10), queryValidator); + }; + + createDeleteContainerWithSameName(func); + } + + @Test(groups = {"emulator"}, timeOut = TIMEOUT) + public void readItem() throws Exception { + + Consumer func = (container) -> { + TestObject docDefinition = getDocumentDefinition(); + container.createItem(docDefinition).block(); + + Mono> responseMono = container.readItem(docDefinition.getId(), + new PartitionKey(docDefinition.getMypk()), + new CosmosItemRequestOptions(), + TestObject.class); + + CosmosItemResponseValidator validator = + new CosmosItemResponseValidator.Builder>() + .withId(docDefinition.getId()) + .build(); + + this.validateItemSuccess(responseMono, validator); + }; + + createDeleteContainerWithSameName(func); + } + + @Test(groups = {"emulator"}, timeOut = TIMEOUT) + public void deleteItem() throws Exception { + + Consumer func = (container) -> { + TestObject docDefinition = getDocumentDefinition(); + container.createItem(docDefinition).block(); + + Mono> deleteObservable = container.deleteItem( + docDefinition.getId(), + new PartitionKey(docDefinition.getMypk()), + new CosmosItemRequestOptions()); + + CosmosItemResponseValidator validator = + new CosmosItemResponseValidator.Builder>() + .nullResource() + .build(); + this.validateItemSuccess(deleteObservable, validator); + }; + + createDeleteContainerWithSameName(func); + } + + @Test(groups = {"emulator"}, timeOut = TIMEOUT) + public void upsertItem() throws Exception { + + Consumer func = (container) -> { + TestObject docDefinition = getDocumentDefinition(); + docDefinition = container.createItem(docDefinition).block().getItem(); + + docDefinition.setProp(UUID.randomUUID().toString()); + + Mono> readObservable = container.upsertItem(docDefinition, new CosmosItemRequestOptions()); + + // Validate result + CosmosItemResponseValidator validator = + new CosmosItemResponseValidator.Builder>() + .withProperty("prop", docDefinition.getProp()) + .build(); + + this.validateItemSuccess(readObservable, validator); + }; + + createDeleteContainerWithSameName(func); + } + + @Test(groups = {"emulator"}, timeOut = TIMEOUT) + public void changeFeed() throws Exception { + + ObjectMapper objectMapper = Utils.getSimpleObjectMapper(); + BiConsumer func = (feedContainer, leaseContainer) -> { + String hostName = RandomStringUtils.randomAlphabetic(6); + int CHANGE_FEED_PROCESSOR_TIMEOUT = 5000; + final int FEED_COUNT = 5; + List createdDocuments = new ArrayList<>(); + Map receivedDocuments = new ConcurrentHashMap<>(); + + setupReadFeedDocuments(createdDocuments, feedContainer, FEED_COUNT); + + ChangeFeedProcessor changeFeedProcessor = new ChangeFeedProcessorBuilder() + .hostName(hostName) + .handleChanges((docs) -> { + for (JsonNode item : docs) { + try { + TestObject obj = objectMapper.treeToValue(item, TestObject.class); + receivedDocuments.put(obj.getId(), obj); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + } + }) + .feedContainer(feedContainer) + .leaseContainer(leaseContainer) + .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.elastic()) + .timeout(Duration.ofMillis(2 * CHANGE_FEED_PROCESSOR_TIMEOUT)) + .subscribe(); + } catch (Exception ex) { + throw ex; + } + + // Wait for the feed processor to receive and process the documents. + try { + Thread.sleep(2 * CHANGE_FEED_PROCESSOR_TIMEOUT); + assertThat(changeFeedProcessor.isStarted()).as("Change Feed Processor instance is running").isTrue(); + + long remainingWork = 2 * CHANGE_FEED_PROCESSOR_TIMEOUT; + while (remainingWork > 0 && receivedDocuments.size() < createdDocuments.size()) { + remainingWork -= 100; + Thread.sleep(100); + } + + assertThat(remainingWork >= 0).as("Failed to receive all the feed documents").isTrue(); + + changeFeedProcessor.stop().subscribeOn(Schedulers.elastic()).timeout(Duration.ofMillis(CHANGE_FEED_PROCESSOR_TIMEOUT)).subscribe(); + + // Wait for the feed processor to shutdown. + Thread.sleep(CHANGE_FEED_PROCESSOR_TIMEOUT); + + } catch (InterruptedException e) { + throw new RuntimeException("Interrupted exception", e); + } + }; + + changeFeedCreateDeleteContainerWithSameName(func); + } + + @BeforeClass(groups = {"emulator"}, timeOut = SETUP_TIMEOUT) + public void before_ContainerCreateDeleteWithSameNameTest() throws Exception { + client = getClientBuilder().buildAsyncClient(); + createdDatabase = getSharedCosmosDatabase(client); + } + + @AfterClass(groups = {"emulator"}, timeOut = SETUP_TIMEOUT) + public void after_ContainerCreateDeleteWithSameNameTest() throws Exception { + safeDeleteAllCollections(createdDatabase); + } + + private void createDeleteContainerWithSameName(Consumer validateFunc) throws InterruptedException { + CosmosAsyncContainer container = null; + try { + // step1: create container + String testContainerId = UUID.randomUUID().toString(); + CosmosContainerProperties containerProperties = getCollectionDefinition(testContainerId); + container = createCollection(this.createdDatabase, containerProperties, new CosmosContainerRequestOptions()); + + // Step2: execute func + validateFunc.accept(container); + + // step3: delete the container + safeDeleteCollection(container); + Thread.sleep(COLLECTION_RECREATION_TIME_DELAY); + + // step4: recreate the container with same id as step1 + container = createCollection(this.createdDatabase, containerProperties, new CosmosContainerRequestOptions()); + + // step5: same as step2. + // This part will confirm the cache refreshed correctly + validateFunc.accept(container); + } finally { + safeDeleteCollection(container); + } + } + + private void changeFeedCreateDeleteContainerWithSameName(BiConsumer validateFunc) throws InterruptedException { + CosmosAsyncContainer feedContainer = null; + CosmosAsyncContainer leaseContainer = null; + + try { + // step1: create feed container and lease container + String feedContainerId = UUID.randomUUID().toString(); + CosmosContainerProperties feedContainerProperties = getCollectionDefinition(feedContainerId); + feedContainer = createCollection(this.createdDatabase, feedContainerProperties, new CosmosContainerRequestOptions()); + + String leaseContainerId = UUID.randomUUID().toString(); + CosmosContainerProperties leaseContainerProperties = getCollectionDefinition(leaseContainerId); + leaseContainer = createLeaseContainer(leaseContainerProperties.getId()); + + // Step2: execute func + validateFunc.accept(feedContainer, leaseContainer); + + // step3: delete the lease container + safeDeleteCollection(leaseContainer); + truncateCollection(feedContainer); + Thread.sleep(COLLECTION_RECREATION_TIME_DELAY); + + // step4: recreate the lease container and lease container with same ids as step1 + leaseContainer = createLeaseContainer(leaseContainerProperties.getId()); + + // step5: same as step2. + // This part will confirm the cache refreshed correctly + validateFunc.accept(feedContainer, leaseContainer); + } finally { + safeDeleteCollection(feedContainer); + safeDeleteCollection(leaseContainer); + } + } + + private static TestObject getDocumentDefinition() { + return new TestObject( + UUID.randomUUID().toString(), + UUID.randomUUID().toString(), + UUID.randomUUID().toString() + ); + } + + private void setupReadFeedDocuments(List createdDocuments, CosmosAsyncContainer feedContainer, long count) { + List docDefList = new ArrayList<>(); + + for (int i = 0; i < count; i++) { + docDefList.add(getDocumentDefinition()); + } + + createdDocuments.addAll(bulkInsertBlocking(feedContainer, docDefList)); + waitIfNeededForReplicasToCatchUp(getClientBuilder()); + } + + private CosmosAsyncContainer createLeaseContainer(String conatinerId) { + CosmosContainerRequestOptions options = new CosmosContainerRequestOptions(); + CosmosContainerProperties collectionDefinition = new CosmosContainerProperties(conatinerId, "/id"); + return createCollection(createdDatabase, collectionDefinition, options); + } + + static class TestObject { + String id; + String mypk; + String prop; + + public TestObject() { + } + + public TestObject(String id, String mypk, String prop) { + this.id = id; + this.mypk = mypk; + this.prop = prop; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getMypk() { + return mypk; + } + + public void setMypk(String mypk) { + this.mypk = mypk; + } + + public String getProp() { + return prop; + } + + public void setProp(String prop) { + this.prop = prop; + } + } +} diff --git a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/CollectionQueryTest.java b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/ContainerQueryTest.java similarity index 67% rename from sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/CollectionQueryTest.java rename to sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/ContainerQueryTest.java index 1349df5d905b..2e2fb261377e 100644 --- a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/CollectionQueryTest.java +++ b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/ContainerQueryTest.java @@ -6,11 +6,12 @@ import com.azure.cosmos.CosmosAsyncContainer; import com.azure.cosmos.CosmosAsyncDatabase; import com.azure.cosmos.CosmosClientBuilder; +import com.azure.cosmos.implementation.InternalObjectNode; import com.azure.cosmos.models.CosmosContainerProperties; +import com.azure.cosmos.models.PartitionKeyDefinition; import com.azure.cosmos.util.CosmosPagedFlux; import com.azure.cosmos.CosmosDatabaseForTest; import com.azure.cosmos.models.CosmosQueryRequestOptions; -import com.azure.cosmos.models.PartitionKeyDefinition; import com.azure.cosmos.implementation.FeedResponseListValidator; import com.azure.cosmos.implementation.FeedResponseValidator; import org.apache.commons.lang3.StringUtils; @@ -26,39 +27,39 @@ import static org.assertj.core.api.Assertions.assertThat; -public class CollectionQueryTest extends TestSuiteBase { +public class ContainerQueryTest extends TestSuiteBase { private final static int TIMEOUT = 30000; private final String databaseId = CosmosDatabaseForTest.generateId(); - private List createdCollections = new ArrayList<>(); + private List createdContainers = new ArrayList<>(); private CosmosAsyncClient client; private CosmosAsyncDatabase createdDatabase; @Factory(dataProvider = "clientBuilders") - public CollectionQueryTest(CosmosClientBuilder clientBuilder) { + public ContainerQueryTest(CosmosClientBuilder clientBuilder) { super(clientBuilder); this.subscriberValidationTimeout = TIMEOUT; } @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryCollectionsWithFilter() throws Exception { + public void queryContainersWithFilter() throws Exception { - String filterCollectionId = createdCollections.get(0).getId(); - String query = String.format("SELECT * from c where c.id = '%s'", filterCollectionId); + String filterContainerId = createdContainers.get(0).getId(); + String query = String.format("SELECT * from c where c.id = '%s'", filterContainerId); CosmosQueryRequestOptions options = new CosmosQueryRequestOptions(); int maxItemCount = 2; CosmosPagedFlux queryObservable = createdDatabase.queryContainers(query, options); - List expectedCollections = createdCollections.stream() - .filter(c -> StringUtils.equals(filterCollectionId, c.getId()) ).collect(Collectors.toList()); + List expectedContainers = createdContainers.stream() + .filter(c -> StringUtils.equals(filterContainerId, c.getId()) ).collect(Collectors.toList()); - assertThat(expectedCollections).isNotEmpty(); + assertThat(expectedContainers).isNotEmpty(); - int expectedPageSize = (expectedCollections.size() + maxItemCount - 1) / maxItemCount; + int expectedPageSize = (expectedContainers.size() + maxItemCount - 1) / maxItemCount; FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedCollections.size()) - .exactlyContainsInAnyOrder(expectedCollections.stream().map(d -> d.read().block().getProperties().getResourceId()).collect(Collectors.toList())) + .totalSize(expectedContainers.size()) + .exactlyContainsInAnyOrder(expectedContainers.stream().map(d -> d.read().block().getProperties().getResourceId()).collect(Collectors.toList())) .numberOfPages(expectedPageSize) .pageSatisfy(0, new FeedResponseValidator.Builder() .requestChargeGreaterThanOrEqualTo(1.0).build()) @@ -68,7 +69,7 @@ public void queryCollectionsWithFilter() throws Exception { } @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryAllCollections() throws Exception { + public void queryAllContainers() throws Exception { String query = "SELECT * from c"; @@ -76,15 +77,15 @@ public void queryAllCollections() throws Exception { int maxItemCount = 2; CosmosPagedFlux queryObservable = createdDatabase.queryContainers(query, options); - List expectedCollections = createdCollections; + List expectedContainers = createdContainers; - assertThat(expectedCollections).isNotEmpty(); + assertThat(expectedContainers).isNotEmpty(); - int expectedPageSize = (expectedCollections.size() + maxItemCount - 1) / maxItemCount; + int expectedPageSize = (expectedContainers.size() + maxItemCount - 1) / maxItemCount; FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedCollections.size()) - .exactlyContainsInAnyOrder(expectedCollections.stream().map(d -> d.read().block().getProperties().getResourceId()).collect(Collectors.toList())) + .totalSize(expectedContainers.size()) + .exactlyContainsInAnyOrder(expectedContainers.stream().map(d -> d.read().block().getProperties().getResourceId()).collect(Collectors.toList())) .numberOfPages(expectedPageSize) .pageSatisfy(0, new FeedResponseValidator.Builder() .requestChargeGreaterThanOrEqualTo(1.0).build()) @@ -94,7 +95,7 @@ public void queryAllCollections() throws Exception { } @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryCollections_NoResults() throws Exception { + public void queryContainers_NoResults() throws Exception { String query = "SELECT * from root r where r.id = '2'"; CosmosQueryRequestOptions options = new CosmosQueryRequestOptions(); @@ -110,7 +111,7 @@ public void queryCollections_NoResults() throws Exception { } @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void before_CollectionQueryTest() throws Exception { + public void before_ContainerQueryTest() throws Exception { client = getClientBuilder().buildAsyncClient(); createdDatabase = createDatabase(client, databaseId); @@ -119,8 +120,8 @@ public void before_CollectionQueryTest() throws Exception { paths.add("/mypk"); partitionKeyDef.setPaths(paths); - CosmosContainerProperties collection = new CosmosContainerProperties(UUID.randomUUID().toString(), partitionKeyDef); - createdCollections.add(createCollection(client, databaseId, collection)); + CosmosContainerProperties container = new CosmosContainerProperties(UUID.randomUUID().toString(), partitionKeyDef); + createdContainers.add(createCollection(client, databaseId, container)); } @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) @@ -128,4 +129,14 @@ public void afterClass() { safeDeleteDatabase(createdDatabase); safeClose(client); } + + private static InternalObjectNode getDocumentDefinition() { + String uuid = UUID.randomUUID().toString(); + InternalObjectNode doc = new InternalObjectNode(String.format("{ " + + "\"id\": \"%s\", " + + "\"mypk\": \"%s\", " + + "}" + , uuid, uuid)); + return doc; + } } diff --git a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/OffsetLimitQueryTests.java b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/OffsetLimitQueryTests.java index 2b96d2ff8b8b..84d4612ea6d3 100644 --- a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/OffsetLimitQueryTests.java +++ b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/OffsetLimitQueryTests.java @@ -8,6 +8,8 @@ import com.azure.cosmos.CosmosAsyncContainer; import com.azure.cosmos.CosmosAsyncDatabase; import com.azure.cosmos.CosmosClientBuilder; +import com.azure.cosmos.implementation.Resource; +import com.azure.cosmos.models.ModelBridgeInternal; import com.azure.cosmos.util.CosmosPagedFlux; import com.azure.cosmos.implementation.InternalObjectNode; import com.azure.cosmos.models.CosmosQueryRequestOptions; @@ -16,6 +18,7 @@ import com.azure.cosmos.implementation.FeedResponseValidator; import com.azure.cosmos.implementation.Utils; import com.azure.cosmos.implementation.query.OffsetContinuationToken; +import com.fasterxml.jackson.databind.JsonNode; import io.reactivex.subscribers.TestSubscriber; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; @@ -23,11 +26,13 @@ import org.testng.annotations.Test; import java.util.ArrayList; +import java.util.Comparator; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; import static org.assertj.core.api.Assertions.assertThat; @@ -130,6 +135,56 @@ public void queryDocumentsWithOffsetContinuationTokens() { this.queryWithContinuationTokensAndPageSizes(query, new int[] {1, 5, 15}, takeCount); } + @Test(groups = {"simple"}, timeOut = TIMEOUT, dataProvider = "queryMetricsArgProvider") + public void queryDocumentsWithDistinct(boolean qmEnabled) { + int skipCount = 4; + int takeCount = 10; + String query = + String.format("SELECT DISTINCT c.id from c OFFSET %s LIMIT %s", skipCount, takeCount); + CosmosQueryRequestOptions options = new CosmosQueryRequestOptions(); + options.setQueryMetricsEnabled(qmEnabled); + options.setMaxDegreeOfParallelism(2); + CosmosPagedFlux queryObservable = createdCollection.queryItems(query, options, InternalObjectNode.class); + + List expectedIds = + docs.stream().skip(4).limit(10).map(doc -> doc.getResourceId()).collect(Collectors.toList()); + + FeedResponseListValidator validator = + new FeedResponseListValidator.Builder() + .containsExactly(expectedIds) + .numberOfPages(3) + .hasValidQueryMetrics(qmEnabled) + .build(); + + validateQuerySuccess(queryObservable.byPage(5), validator, TIMEOUT); + } + + @Test(groups = {"simple"}, timeOut = TIMEOUT, dataProvider = "queryMetricsArgProvider") + public void queryDocumentsWithAggregate(boolean qmEnabled) { + int skipCount = 0; + int takeCount = 10; + String query = + String.format("SELECT VALUE MAX(c.%s) from c OFFSET %s LIMIT %s", field, skipCount, takeCount); + CosmosQueryRequestOptions options = new CosmosQueryRequestOptions(); + options.setQueryMetricsEnabled(qmEnabled); + CosmosPagedFlux queryObservable = createdCollection.queryItems(query, options, JsonNode.class); + + // The pipeline execution sequence is Aggregrate, skip, and top/limit, hence finding the max from among the docs + InternalObjectNode expectedDoc = docs + .stream() + .max(Comparator.comparing(r -> ModelBridgeInternal.getIntFromJsonSerializable(r, field))) + .get(); + + FeedResponseListValidator validator = + new FeedResponseListValidator.Builder() + .withAggregateValue(ModelBridgeInternal.getIntFromJsonSerializable(expectedDoc, field)) + .numberOfPages(1) + .hasValidQueryMetrics(qmEnabled) + .build(); + + validateQuerySuccess(queryObservable.byPage(5), validator, TIMEOUT); + } + private void queryWithContinuationTokensAndPageSizes(String query, int[] pageSizes, int takeCount) { for (int pageSize : pageSizes) { List receivedDocuments = this.queryWithContinuationTokens(query, pageSize); diff --git a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/StoredProcedureUpsertReplaceTest.java b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/StoredProcedureUpsertReplaceTest.java index fc32d95fb501..f943f28f21e6 100644 --- a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/StoredProcedureUpsertReplaceTest.java +++ b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/StoredProcedureUpsertReplaceTest.java @@ -18,6 +18,8 @@ import org.testng.annotations.Test; import reactor.core.publisher.Mono; +import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; import java.util.UUID; import static org.assertj.core.api.Assertions.assertThat; @@ -92,6 +94,37 @@ public void executeStoredProcedure() throws Exception { assertThat(result).isEqualTo("\"0123456789\""); } + @Test(groups = "simple", timeOut = TIMEOUT) + public void executeStoredProcedureWithScriptLoggingEnabled() throws Exception { + // Create a stored procedure + CosmosStoredProcedureProperties storedProcedure = new CosmosStoredProcedureProperties( + UUID.randomUUID().toString(), + "function() {" + + " var mytext = \"x\";" + + " var myval = 1;" + + " try {" + + " console.log(\"The value of %s is %s.\", mytext, myval);" + + " getContext().getResponse().setBody(\"Success!\");" + + " }" + + " catch(err) {" + + " getContext().getResponse().setBody(\"inline err: [\" + err.number + \"] \" + err);" + + " }" + + "}"); + + createdCollection.getScripts().createStoredProcedure(storedProcedure).block(); + CosmosStoredProcedureRequestOptions options = new CosmosStoredProcedureRequestOptions(); + options.setScriptLoggingEnabled(true); + options.setPartitionKey(PartitionKey.NONE); + + CosmosStoredProcedureResponse executeResponse = createdCollection.getScripts() + .getStoredProcedure(storedProcedure.getId()) + .execute(null, options).block(); + + String logResult = "The value of x is 1."; + assert executeResponse != null; + assertThat(executeResponse.getScriptLog()).isEqualTo(logResult); + } + @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) public void before_StoredProcedureUpsertReplaceTest() { client = getClientBuilder().buildAsyncClient(); diff --git a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/TestSuiteBase.java b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/TestSuiteBase.java index dead021f8e7e..a5e0e0682e93 100644 --- a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/TestSuiteBase.java +++ b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/TestSuiteBase.java @@ -516,12 +516,16 @@ private static CosmosAsyncContainer safeCreateCollection(CosmosAsyncClient clien } static protected CosmosContainerProperties getCollectionDefinition() { + return getCollectionDefinition(UUID.randomUUID().toString()); + } + + static protected CosmosContainerProperties getCollectionDefinition(String collectionId) { PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList(); + ArrayList paths = new ArrayList<>(); paths.add("/mypk"); partitionKeyDef.setPaths(paths); - CosmosContainerProperties collectionDefinition = new CosmosContainerProperties(UUID.randomUUID().toString(), partitionKeyDef); + CosmosContainerProperties collectionDefinition = new CosmosContainerProperties(collectionId, partitionKeyDef); return collectionDefinition; } diff --git a/sdk/cosmos/azure-spring-data-cosmos/CHANGELOG.md b/sdk/cosmos/azure-spring-data-cosmos/CHANGELOG.md new file mode 100644 index 000000000000..02434784717d --- /dev/null +++ b/sdk/cosmos/azure-spring-data-cosmos/CHANGELOG.md @@ -0,0 +1,3 @@ +# Release History + +## 3.0.0-beta.1 (Unreleased) diff --git a/sdk/cosmos/azure-spring-data-cosmos/Contributing.md b/sdk/cosmos/azure-spring-data-cosmos/Contributing.md new file mode 100644 index 000000000000..daad18919bf4 --- /dev/null +++ b/sdk/cosmos/azure-spring-data-cosmos/Contributing.md @@ -0,0 +1,62 @@ +# Contributing +This instruction is guideline for building and code contribution. + +## Prequisites +- JDK 1.8 and above +- [Maven](http://maven.apache.org/) 3.0 and above + +## Build from source +To build the project, run maven commands. + +```bash +git clone https://github.com/Azure/azure-sdk-for-java.git +cd sdk/cosmos/azure-spring-data-cosmos +mvnw clean install +``` + +## Test +There're integration tests on azure and on emulator to trigger integration test execution against Azure Cosmos DB and against [Azure Cosmos DB Emulator](https://docs.microsoft.com/azure/cosmos-db/local-emulator), you need to follow the link to setup emulator before test execution. + +- Run unit tests +```bash +mvn clean install -Dgpg.skip +``` + +- Run integration tests + - on Azure + >**NOTE** Please note that integration test against Azure requires Azure Cosmos DB Document API and will automatically create a Cosmos database in your Azure subscription, then there will be **Azure usage fee.** + + Integration tests will require a Azure Subscription. If you don't already have an Azure subscription, you can activate your [MSDN subscriber benefits](https://azure.microsoft.com/pricing/member-offers/msdn-benefits-details/) or sign up for a [free Azure account](https://azure.microsoft.com/free/). + + 1. Create an Azure Cosmos DB on Azure. + - Go to [Azure portal](https://portal.azure.com/) and click +New. + - Click Databases, and then click Azure Cosmos DB to create your database. + - Navigate to the database you have created, and click Access keys and copy your URI and access keys for your database. + + 2. Set environment variables ACCOUNT_HOST, ACCOUNT_KEY and SECONDARY_ACCOUNT_KEY, where value of them are Cosmos account URI, primary key and secondary key. + 3. Run maven command with `integration-test-azure` profile. + + ```bash + set ACCOUNT_HOST=your-cosmos-account-uri + set ACCOUNT_KEY=your-cosmos-account-primary-key + set SECONDARY_ACCOUNT_KEY=your-cosmos-account-secondary-key + mvnw -P integration-test-azure clean install + ``` + - on Emulator + + Setup Azure Cosmos DB Emulator by following [this instruction](https://docs.microsoft.com/azure/cosmos-db/local-emulator), and set associated environment variables. Then run test with: + ```bash + mvnw -P integration-test-emulator install + ``` + + +- Skip tests execution +```bash +mvn clean install -Dgpg.skip-DskipTests +``` + +## Version management +Developing version naming convention is like `0.1.2-beta.1`. Release version naming convention is like `0.1.2`. + +## Contribute to code +Contribution is welcome. Please follow [this instruction](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md) to contribute code. diff --git a/sdk/cosmos/azure-spring-data-cosmos/README.md b/sdk/cosmos/azure-spring-data-cosmos/README.md new file mode 100644 index 000000000000..c6e8f26a2772 --- /dev/null +++ b/sdk/cosmos/azure-spring-data-cosmos/README.md @@ -0,0 +1,25 @@ +#Azure Cosmos DB client library for Java + +## Getting started + +## TOC + +## Examples + +## Spring Data Version Support + +## Feature List + +## Quick Start + +## Snapshots + +## Troubleshooting + +## Contributing + +## Code of Conduct + +## Key concepts + +## Next steps diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/pom.xml b/sdk/cosmos/azure-spring-data-cosmos/pom.xml similarity index 81% rename from sdk/cosmos/azure-spring-data-cosmosdb/pom.xml rename to sdk/cosmos/azure-spring-data-cosmos/pom.xml index c173ad25dd9a..c08922070a6e 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/pom.xml +++ b/sdk/cosmos/azure-spring-data-cosmos/pom.xml @@ -10,20 +10,20 @@ ../../parents/azure-client-sdk-parent - com.microsoft.azure - spring-data-cosmosdb - 2.3.1-beta.1 - + com.azure + azure-spring-data-cosmos + 3.0.0-beta.1 + jar Spring Data for Azure Cosmos DB SQL API Spring Data for Azure Cosmos DB SQL API - https://github.com/Microsoft/spring-data-cosmosdb + https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/cosmos/azure-spring-data-cosmos MM-dd-HH-mm-ss 0.17 0.18 - spring-data-cosmosdb-test + azure-spring-data-cosmos-test testdb-${maven.build.timestamp} true false @@ -213,29 +213,6 @@ - - org.codehaus.mojo - cobertura-maven-plugin - 2.7 - - - html - xml - - - true - 65 - 65 - - - - com/microsoft/azure/**/GetHashMac.class - com/microsoft/azure/**/Constants.class - - - - - org.apache.maven.plugins maven-failsafe-plugin @@ -254,22 +231,72 @@ + org.apache.maven.plugins maven-javadoc-plugin 3.1.1 - private - - BasicCosmosPersistentProperty.java - + com/azure/spring/data/cosmos/core/mapping/BasicCosmosPersistentProperty.java - ${basedir}/src/main/java/com/microsoft/azure/spring/data/cosmosdb/core/mapping/ + + + org.projectlombok + lombok + 1.18.6 + + - + + + dev + + true + + + dev + true + false + false + + + + integration-test-azure + + integration-test-azure + false + true + false + + + + integration-test-emulator + + integration-test-emulator + false + false + true + + + + + org.apache.maven.plugins + maven-failsafe-plugin + 2.22.0 + + + + **/PageablePersonRepositoryIT.java + + + + + + + diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/Constants.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/Constants.java similarity index 96% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/Constants.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/Constants.java index 63001bddc981..58b945d2d507 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/Constants.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/Constants.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb; +package com.azure.spring.data.cosmos; import com.azure.data.cosmos.IndexingMode; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/CosmosDbFactory.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/CosmosDbFactory.java similarity index 92% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/CosmosDbFactory.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/CosmosDbFactory.java index 20ca21753504..9c2d185320a2 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/CosmosDbFactory.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/CosmosDbFactory.java @@ -1,15 +1,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb; +package com.azure.spring.data.cosmos; import com.azure.data.cosmos.ConnectionPolicy; import com.azure.data.cosmos.CosmosClient; import com.azure.data.cosmos.sync.CosmosSyncClient; -import com.microsoft.azure.spring.data.cosmosdb.common.MacAddress; -import com.microsoft.azure.spring.data.cosmosdb.common.PropertyLoader; -import com.microsoft.azure.spring.data.cosmosdb.common.TelemetrySender; -import com.microsoft.azure.spring.data.cosmosdb.config.CosmosDBConfig; +import com.azure.spring.data.cosmos.common.MacAddress; +import com.azure.spring.data.cosmos.common.PropertyLoader; +import com.azure.spring.data.cosmos.common.TelemetrySender; +import com.azure.spring.data.cosmos.config.CosmosDBConfig; import org.springframework.lang.NonNull; import org.springframework.util.Assert; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/common/CosmosdbUtils.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/common/CosmosdbUtils.java similarity index 89% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/common/CosmosdbUtils.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/common/CosmosdbUtils.java index 446a67539437..6e0e052d8025 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/common/CosmosdbUtils.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/common/CosmosdbUtils.java @@ -1,17 +1,17 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.common; +package com.azure.spring.data.cosmos.common; import com.azure.data.cosmos.CosmosResponse; import com.azure.data.cosmos.CosmosResponseDiagnostics; import com.azure.data.cosmos.FeedResponse; import com.azure.data.cosmos.FeedResponseDiagnostics; import com.azure.data.cosmos.Resource; +import com.azure.spring.data.cosmos.core.convert.ObjectMapperFactory; +import com.azure.spring.data.cosmos.exception.ConfigurationException; import com.fasterxml.jackson.databind.ObjectMapper; -import com.microsoft.azure.spring.data.cosmosdb.core.ResponseDiagnostics; -import com.microsoft.azure.spring.data.cosmosdb.core.ResponseDiagnosticsProcessor; -import com.microsoft.azure.spring.data.cosmosdb.core.convert.ObjectMapperFactory; -import com.microsoft.azure.spring.data.cosmosdb.exception.ConfigurationException; +import com.azure.spring.data.cosmos.core.ResponseDiagnostics; +import com.azure.spring.data.cosmos.core.ResponseDiagnosticsProcessor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.lang.NonNull; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/common/ExpressionResolver.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/common/ExpressionResolver.java similarity index 96% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/common/ExpressionResolver.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/common/ExpressionResolver.java index c992ae5eaa4a..2d4261016a72 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/common/ExpressionResolver.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/common/ExpressionResolver.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.common; +package com.azure.spring.data.cosmos.common; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/common/MacAddress.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/common/MacAddress.java similarity index 98% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/common/MacAddress.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/common/MacAddress.java index 9db4d22a09ef..41ff8997e186 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/common/MacAddress.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/common/MacAddress.java @@ -7,7 +7,7 @@ * Location in the repo: /Utils/azuretools-core/src/com/microsoft/azuretools/azurecommons/util/MacAddress.java */ -package com.microsoft.azure.spring.data.cosmosdb.common; +package com.azure.spring.data.cosmos.common; import org.springframework.lang.NonNull; import org.springframework.util.Assert; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/common/Memoizer.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/common/Memoizer.java similarity index 94% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/common/Memoizer.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/common/Memoizer.java index ce3530647e72..f628528e0e04 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/common/Memoizer.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/common/Memoizer.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.common; +package com.azure.spring.data.cosmos.common; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/common/PropertyLoader.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/common/PropertyLoader.java similarity index 97% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/common/PropertyLoader.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/common/PropertyLoader.java index e01c5bba3221..58446d470828 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/common/PropertyLoader.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/common/PropertyLoader.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.common; +package com.azure.spring.data.cosmos.common; import org.springframework.lang.NonNull; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/common/TelemetryEventData.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/common/TelemetryEventData.java similarity index 98% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/common/TelemetryEventData.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/common/TelemetryEventData.java index 56a980dcd3d0..bb6af01be6cb 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/common/TelemetryEventData.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/common/TelemetryEventData.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.common; +package com.azure.spring.data.cosmos.common; import com.fasterxml.jackson.annotation.JsonProperty; import org.springframework.lang.NonNull; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/common/TelemetrySender.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/common/TelemetrySender.java similarity index 96% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/common/TelemetrySender.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/common/TelemetrySender.java index d6ef8baac173..c57df311ff78 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/common/TelemetrySender.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/common/TelemetrySender.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.common; +package com.azure.spring.data.cosmos.common; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; @@ -33,7 +33,7 @@ public class TelemetrySender { private static final String PROPERTY_SERVICE_NAME = "serviceName"; - private static final String PROJECT_INFO = "spring-data-cosmosdb/" + private static final String PROJECT_INFO = "azure-spring-data-cosmos/" + PropertyLoader.getProjectVersion(); private static final String TELEMETRY_TARGET_URL = "https://dc.services.visualstudio.com/v2/track"; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/common/package-info.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/common/package-info.java similarity index 74% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/common/package-info.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/common/package-info.java index bbfa061b299a..8d421f5a0492 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/common/package-info.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/common/package-info.java @@ -4,4 +4,4 @@ /** * This package contains the classes of utils for cosmosdb */ -package com.microsoft.azure.spring.data.cosmosdb.common; +package com.azure.spring.data.cosmos.common; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/config/AbstractCosmosConfiguration.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/config/AbstractCosmosConfiguration.java similarity index 87% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/config/AbstractCosmosConfiguration.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/config/AbstractCosmosConfiguration.java index 005398857889..cf9b204e4b2d 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/config/AbstractCosmosConfiguration.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/config/AbstractCosmosConfiguration.java @@ -1,16 +1,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.config; +package com.azure.spring.data.cosmos.config; import com.azure.data.cosmos.CosmosClient; import com.azure.data.cosmos.sync.CosmosSyncClient; +import com.azure.spring.data.cosmos.core.convert.MappingCosmosConverter; import com.fasterxml.jackson.databind.ObjectMapper; -import com.microsoft.azure.spring.data.cosmosdb.Constants; -import com.microsoft.azure.spring.data.cosmosdb.CosmosDbFactory; -import com.microsoft.azure.spring.data.cosmosdb.core.CosmosTemplate; -import com.microsoft.azure.spring.data.cosmosdb.core.ReactiveCosmosTemplate; -import com.microsoft.azure.spring.data.cosmosdb.core.convert.MappingCosmosConverter; +import com.azure.spring.data.cosmos.CosmosDbFactory; +import com.azure.spring.data.cosmos.Constants; +import com.azure.spring.data.cosmos.core.CosmosTemplate; +import com.azure.spring.data.cosmos.core.ReactiveCosmosTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/config/CosmosConfigurationSupport.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/config/CosmosConfigurationSupport.java similarity index 94% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/config/CosmosConfigurationSupport.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/config/CosmosConfigurationSupport.java index 458cc27cb253..07bd795e99fc 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/config/CosmosConfigurationSupport.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/config/CosmosConfigurationSupport.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.config; +package com.azure.spring.data.cosmos.config; -import com.microsoft.azure.spring.data.cosmosdb.common.ExpressionResolver; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.CosmosMappingContext; +import com.azure.spring.data.cosmos.core.mapping.CosmosMappingContext; +import com.azure.spring.data.cosmos.common.ExpressionResolver; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.context.annotation.Bean; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/config/CosmosDBConfig.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/config/CosmosDBConfig.java similarity index 98% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/config/CosmosDBConfig.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/config/CosmosDBConfig.java index d8b607986dd7..2cab7cb3466c 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/config/CosmosDBConfig.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/config/CosmosDBConfig.java @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.config; +package com.azure.spring.data.cosmos.config; import com.azure.data.cosmos.ConnectionPolicy; import com.azure.data.cosmos.ConsistencyLevel; import com.azure.data.cosmos.CosmosKeyCredential; import com.azure.data.cosmos.internal.RequestOptions; -import com.microsoft.azure.spring.data.cosmosdb.core.ResponseDiagnosticsProcessor; -import com.microsoft.azure.spring.data.cosmosdb.exception.CosmosDBAccessException; +import com.azure.spring.data.cosmos.core.ResponseDiagnosticsProcessor; +import com.azure.spring.data.cosmos.exception.CosmosDBAccessException; import org.springframework.util.Assert; import java.beans.ConstructorProperties; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/config/package-info.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/config/package-info.java similarity index 75% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/config/package-info.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/config/package-info.java index f2fcbfbf6754..af2cccf865d6 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/config/package-info.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/config/package-info.java @@ -4,4 +4,4 @@ /** * This package contains the classes to configure properties of cosmos db */ -package com.microsoft.azure.spring.data.cosmosdb.config; +package com.azure.spring.data.cosmos.config; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/CosmosOperations.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/CosmosOperations.java similarity index 96% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/CosmosOperations.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/CosmosOperations.java index 458e29377112..b723c4d9423e 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/CosmosOperations.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/CosmosOperations.java @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core; +package com.azure.spring.data.cosmos.core; import com.azure.data.cosmos.CosmosContainerProperties; import com.azure.data.cosmos.PartitionKey; -import com.microsoft.azure.spring.data.cosmosdb.core.convert.MappingCosmosConverter; -import com.microsoft.azure.spring.data.cosmosdb.core.query.DocumentQuery; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.core.convert.MappingCosmosConverter; +import com.azure.spring.data.cosmos.core.query.DocumentQuery; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/CosmosTemplate.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/CosmosTemplate.java similarity index 88% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/CosmosTemplate.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/CosmosTemplate.java index 2e3a5c116cb7..2fbe470dc45a 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/CosmosTemplate.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/CosmosTemplate.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core; +package com.azure.spring.data.cosmos.core; import com.azure.data.cosmos.CosmosItemResponse; import com.azure.data.cosmos.AccessCondition; @@ -15,17 +15,19 @@ import com.azure.data.cosmos.CosmosContainerProperties; import com.azure.data.cosmos.CosmosContainerResponse; import com.azure.data.cosmos.PartitionKey; -import com.microsoft.azure.spring.data.cosmosdb.CosmosDbFactory; -import com.microsoft.azure.spring.data.cosmosdb.common.Memoizer; -import com.microsoft.azure.spring.data.cosmosdb.core.convert.MappingCosmosConverter; -import com.microsoft.azure.spring.data.cosmosdb.core.generator.CountQueryGenerator; -import com.microsoft.azure.spring.data.cosmosdb.core.generator.FindQuerySpecGenerator; -import com.microsoft.azure.spring.data.cosmosdb.core.query.Criteria; -import com.microsoft.azure.spring.data.cosmosdb.core.query.CosmosPageImpl; -import com.microsoft.azure.spring.data.cosmosdb.core.query.CriteriaType; -import com.microsoft.azure.spring.data.cosmosdb.core.query.DocumentQuery; -import com.microsoft.azure.spring.data.cosmosdb.core.query.CosmosPageRequest; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.common.CosmosdbUtils; +import com.azure.spring.data.cosmos.common.Memoizer; +import com.azure.spring.data.cosmos.core.convert.MappingCosmosConverter; +import com.azure.spring.data.cosmos.core.generator.CountQueryGenerator; +import com.azure.spring.data.cosmos.core.generator.FindQuerySpecGenerator; +import com.azure.spring.data.cosmos.core.query.CosmosPageImpl; +import com.azure.spring.data.cosmos.core.query.CosmosPageRequest; +import com.azure.spring.data.cosmos.core.query.Criteria; +import com.azure.spring.data.cosmos.core.query.CriteriaType; +import com.azure.spring.data.cosmos.core.query.DocumentQuery; +import com.azure.spring.data.cosmos.exception.CosmosDBExceptionUtils; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.CosmosDbFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeansException; @@ -46,10 +48,6 @@ import java.util.function.Function; import java.util.stream.Collectors; -import static com.microsoft.azure.spring.data.cosmosdb.common.CosmosdbUtils.fillAndProcessResponseDiagnostics; -import static com.microsoft.azure.spring.data.cosmosdb.exception.CosmosDBExceptionUtils.exceptionHandler; -import static com.microsoft.azure.spring.data.cosmosdb.exception.CosmosDBExceptionUtils.findAPIExceptionHandler; - /** * Template class for cosmos db */ @@ -136,10 +134,11 @@ public T insert(String containerName, T objectToSave, PartitionKey partition .getDatabase(this.databaseName) .getContainer(containerName) .createItem(originalItem, options) - .doOnNext(cosmosItemResponse -> fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, - cosmosItemResponse, null)) + .doOnNext(cosmosItemResponse -> + CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + cosmosItemResponse, null)) .onErrorResume(throwable -> - exceptionHandler("Failed to insert item", throwable)) + CosmosDBExceptionUtils.exceptionHandler("Failed to insert item", throwable)) .block(); assert response != null; @@ -172,13 +171,13 @@ public T findById(Object id, Class domainType, PartitionKey partitionKey) .getItem(id.toString(), partitionKey) .read() .flatMap(cosmosItemResponse -> { - fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, cosmosItemResponse, null); return Mono.justOrEmpty(toDomainObject(domainType, cosmosItemResponse.properties())); }) .onErrorResume(throwable -> - findAPIExceptionHandler("Failed to find item", throwable)) + CosmosDBExceptionUtils.findAPIExceptionHandler("Failed to find item", throwable)) .block(); } @@ -204,7 +203,7 @@ public T findById(String containerName, Object id, Class domainType) { .getContainer(containerName) .queryItems(query, options) .flatMap(cosmosItemFeedResponse -> { - fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, null, cosmosItemFeedResponse); return Mono.justOrEmpty(cosmosItemFeedResponse .results() @@ -213,7 +212,7 @@ public T findById(String containerName, Object id, Class domainType) { .findFirst()); }) .onErrorResume(throwable -> - findAPIExceptionHandler("Failed to find item", throwable)) + CosmosDBExceptionUtils.findAPIExceptionHandler("Failed to find item", throwable)) .blockFirst(); } @@ -267,9 +266,9 @@ public T upsertAndReturnEntity(String containerName, T object, PartitionKey .getDatabase(this.databaseName) .getContainer(containerName) .upsertItem(originalItem, options) - .doOnNext(response -> fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + .doOnNext(response -> CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, response, null)) - .onErrorResume(throwable -> exceptionHandler("Failed to upsert item", throwable)) + .onErrorResume(throwable -> CosmosDBExceptionUtils.exceptionHandler("Failed to upsert item", throwable)) .block(); assert cosmosItemResponse != null; @@ -325,13 +324,13 @@ public List findAll(PartitionKey partitionKey, final Class domainType) .getContainer(containerName) .readAllItems(feedOptions) .flatMap(cosmosItemFeedResponse -> { - fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, null, cosmosItemFeedResponse); return Flux.fromIterable(cosmosItemFeedResponse.results()); }) .map(cosmosItemProperties -> toDomainObject(domainType, cosmosItemProperties)) .onErrorResume(throwable -> - exceptionHandler("Failed to find items", throwable)) + CosmosDBExceptionUtils.exceptionHandler("Failed to find items", throwable)) .collectList() .block(); } @@ -361,10 +360,10 @@ public void deleteContainer(@NonNull String containerName) { cosmosClient.getDatabase(this.databaseName) .getContainer(containerName) .delete() - .doOnNext(response -> fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + .doOnNext(response -> CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, response, null)) .onErrorResume(throwable -> - exceptionHandler("Failed to delete container", throwable)) + CosmosDBExceptionUtils.exceptionHandler("Failed to delete container", throwable)) .block(); } @@ -394,9 +393,9 @@ public CosmosContainerProperties createContainerIfNotExists(CosmosEntityInformat final CosmosContainerResponse response = cosmosClient .createDatabaseIfNotExists(this.databaseName) .onErrorResume(throwable -> - exceptionHandler("Failed to create database", throwable)) + CosmosDBExceptionUtils.exceptionHandler("Failed to create database", throwable)) .flatMap(cosmosDatabaseResponse -> { - fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, cosmosDatabaseResponse, null); final CosmosContainerProperties cosmosContainerProperties = new CosmosContainerProperties( information.getContainerName(), "/" @@ -407,9 +406,9 @@ public CosmosContainerProperties createContainerIfNotExists(CosmosEntityInformat .database() .createContainerIfNotExists(cosmosContainerProperties, information.getRequestUnit()) .onErrorResume(throwable -> - exceptionHandler("Failed to create container", throwable)) + CosmosDBExceptionUtils.exceptionHandler("Failed to create container", throwable)) .doOnNext(cosmosContainerResponse -> - fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, cosmosContainerResponse, null)); }) .block(); @@ -440,10 +439,10 @@ public void deleteById(String containerName, Object id, PartitionKey partitionKe .getContainer(containerName) .getItem(id.toString(), partitionKey) .delete(options) - .doOnNext(response -> fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + .doOnNext(response -> CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, response, null)) .onErrorResume(throwable -> - exceptionHandler("Failed to delete item", throwable)) + CosmosDBExceptionUtils.exceptionHandler("Failed to delete item", throwable)) .block(); } @@ -547,10 +546,11 @@ public Page paginationQuery(DocumentQuery query, Class domainType, Str .getDatabase(this.databaseName) .getContainer(containerName) .queryItems(sqlQuerySpec, feedOptions) - .doOnNext(propertiesFeedResponse -> fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + .doOnNext(propertiesFeedResponse -> + CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, null, propertiesFeedResponse)) .onErrorResume(throwable -> - exceptionHandler("Failed to query items", throwable)) + CosmosDBExceptionUtils.exceptionHandler("Failed to query items", throwable)) .next() .block(); @@ -632,8 +632,8 @@ private Long getCountValue(DocumentQuery query, boolean isCrossPartitionQuery, S return executeQuery(querySpec, containerName, options) .onErrorResume(throwable -> - exceptionHandler("Failed to get count value", throwable)) - .doOnNext(response -> fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + CosmosDBExceptionUtils.exceptionHandler("Failed to get count value", throwable)) + .doOnNext(response -> CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, null, response)) .next() .map(r -> r.results().get(0).getLong(COUNT_VALUE_KEY)) @@ -646,7 +646,7 @@ private Flux> executeQuery(SqlQuerySpec sqlQu .getContainer(containerName) .queryItems(sqlQuerySpec, options) .onErrorResume(throwable -> - exceptionHandler("Failed to execute query", throwable)); + CosmosDBExceptionUtils.exceptionHandler("Failed to execute query", throwable)); } private List getPartitionKeyNames(Class domainType) { @@ -681,12 +681,12 @@ private List findItems(@NonNull DocumentQuery query, .getContainer(containerName) .queryItems(sqlQuerySpec, feedOptions) .flatMap(cosmosItemFeedResponse -> { - fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, null, cosmosItemFeedResponse); return Flux.fromIterable(cosmosItemFeedResponse.results()); }) .onErrorResume(throwable -> - exceptionHandler("Failed to find items", throwable)) + CosmosDBExceptionUtils.exceptionHandler("Failed to find items", throwable)) .collectList() .block(); } @@ -716,10 +716,10 @@ private CosmosItemResponse deleteItem(@NonNull CosmosItemProperties cosmosItemPr .getContainer(containerName) .getItem(cosmosItemProperties.id(), partitionKey) .delete(options) - .doOnNext(response -> fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + .doOnNext(response -> CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, response, null)) .onErrorResume(throwable -> - exceptionHandler("Failed to delete item", throwable)) + CosmosDBExceptionUtils.exceptionHandler("Failed to delete item", throwable)) .block(); } diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/ReactiveCosmosOperations.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/ReactiveCosmosOperations.java similarity index 93% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/ReactiveCosmosOperations.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/ReactiveCosmosOperations.java index 64bf11e91877..04b4a447db3c 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/ReactiveCosmosOperations.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/ReactiveCosmosOperations.java @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core; +package com.azure.spring.data.cosmos.core; import com.azure.data.cosmos.CosmosContainerResponse; import com.azure.data.cosmos.PartitionKey; -import com.microsoft.azure.spring.data.cosmosdb.core.convert.MappingCosmosConverter; -import com.microsoft.azure.spring.data.cosmosdb.core.query.DocumentQuery; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.core.convert.MappingCosmosConverter; +import com.azure.spring.data.cosmos.core.query.DocumentQuery; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -28,7 +28,7 @@ public interface ReactiveCosmosOperations { * Use createContainerIfNotExists() instead * @param information cosmos entity information * @return Mono of cosmos container response - * @deprecated use createContainerIfNotExists(CosmosEntityInformation) instead. + * @deprecated use {@link #createContainerIfNotExists(CosmosEntityInformation)} instead. */ @Deprecated Mono createCollectionIfNotExists(CosmosEntityInformation information); diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/ReactiveCosmosTemplate.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/ReactiveCosmosTemplate.java similarity index 86% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/ReactiveCosmosTemplate.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/ReactiveCosmosTemplate.java index 38200f453b31..d7f5528d8c05 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/ReactiveCosmosTemplate.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/ReactiveCosmosTemplate.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core; +package com.azure.spring.data.cosmos.core; import com.azure.data.cosmos.AccessCondition; import com.azure.data.cosmos.AccessConditionType; @@ -14,15 +14,17 @@ import com.azure.data.cosmos.CosmosContainerProperties; import com.azure.data.cosmos.CosmosContainerResponse; import com.azure.data.cosmos.PartitionKey; -import com.microsoft.azure.spring.data.cosmosdb.CosmosDbFactory; -import com.microsoft.azure.spring.data.cosmosdb.common.Memoizer; -import com.microsoft.azure.spring.data.cosmosdb.core.convert.MappingCosmosConverter; -import com.microsoft.azure.spring.data.cosmosdb.core.generator.CountQueryGenerator; -import com.microsoft.azure.spring.data.cosmosdb.core.generator.FindQuerySpecGenerator; -import com.microsoft.azure.spring.data.cosmosdb.core.query.Criteria; -import com.microsoft.azure.spring.data.cosmosdb.core.query.CriteriaType; -import com.microsoft.azure.spring.data.cosmosdb.core.query.DocumentQuery; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.common.CosmosdbUtils; +import com.azure.spring.data.cosmos.common.Memoizer; +import com.azure.spring.data.cosmos.core.convert.MappingCosmosConverter; +import com.azure.spring.data.cosmos.core.generator.CountQueryGenerator; +import com.azure.spring.data.cosmos.core.generator.FindQuerySpecGenerator; +import com.azure.spring.data.cosmos.core.query.Criteria; +import com.azure.spring.data.cosmos.core.query.CriteriaType; +import com.azure.spring.data.cosmos.core.query.DocumentQuery; +import com.azure.spring.data.cosmos.exception.CosmosDBExceptionUtils; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.CosmosDbFactory; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; @@ -37,10 +39,6 @@ import java.util.List; import java.util.function.Function; -import static com.microsoft.azure.spring.data.cosmosdb.common.CosmosdbUtils.fillAndProcessResponseDiagnostics; -import static com.microsoft.azure.spring.data.cosmosdb.exception.CosmosDBExceptionUtils.exceptionHandler; -import static com.microsoft.azure.spring.data.cosmosdb.exception.CosmosDBExceptionUtils.findAPIExceptionHandler; - /** * Template class of reactive cosmos */ @@ -113,9 +111,9 @@ public Mono createContainerIfNotExists(CosmosEntityInfo return cosmosClient .createDatabaseIfNotExists(this.databaseName) .onErrorResume(throwable -> - exceptionHandler("Failed to create database", throwable)) + CosmosDBExceptionUtils.exceptionHandler("Failed to create database", throwable)) .flatMap(cosmosDatabaseResponse -> { - fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, cosmosDatabaseResponse, null); final CosmosContainerProperties cosmosContainerProperties = new CosmosContainerProperties( information.getContainerName(), @@ -126,13 +124,13 @@ public Mono createContainerIfNotExists(CosmosEntityInfo .database() .createContainerIfNotExists(cosmosContainerProperties, information.getRequestUnit()) .map(cosmosContainerResponse -> { - fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, cosmosContainerResponse, null); this.containerNameCache.add(information.getContainerName()); return cosmosContainerResponse; }) .onErrorResume(throwable -> - exceptionHandler("Failed to create container", throwable)); + CosmosDBExceptionUtils.exceptionHandler("Failed to create container", throwable)); }); } @@ -178,13 +176,13 @@ public Flux findAll(PartitionKey partitionKey, Class domainType) { .getContainer(containerName) .readAllItems(feedOptions) .flatMap(cosmosItemFeedResponse -> { - fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, null, cosmosItemFeedResponse); return Flux.fromIterable(cosmosItemFeedResponse.results()); }) .map(cosmosItemProperties -> toDomainObject(domainType, cosmosItemProperties)) .onErrorResume(throwable -> - exceptionHandler("Failed to find items", throwable)); + CosmosDBExceptionUtils.exceptionHandler("Failed to find items", throwable)); } /** @@ -223,7 +221,7 @@ public Mono findById(String containerName, Object id, Class domainType .getContainer(containerName) .queryItems(query, options) .flatMap(cosmosItemFeedResponse -> { - fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, null, cosmosItemFeedResponse); return Mono.justOrEmpty(cosmosItemFeedResponse .results() @@ -232,7 +230,7 @@ public Mono findById(String containerName, Object id, Class domainType .findFirst()); }) .onErrorResume(throwable -> - findAPIExceptionHandler("Failed to find item", throwable)) + CosmosDBExceptionUtils.findAPIExceptionHandler("Failed to find item", throwable)) .next(); } @@ -255,13 +253,13 @@ public Mono findById(Object id, Class domainType, PartitionKey partiti .getItem(id.toString(), partitionKey) .read() .flatMap(cosmosItemResponse -> { - fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, cosmosItemResponse, null); return Mono.justOrEmpty(toDomainObject(domainType, cosmosItemResponse.properties())); }) .onErrorResume(throwable -> - findAPIExceptionHandler("Failed to find item", throwable)); + CosmosDBExceptionUtils.findAPIExceptionHandler("Failed to find item", throwable)); } /** @@ -294,9 +292,9 @@ public Mono insert(T objectToSave) { .getContainer(getContainerName(objectToSave.getClass())) .createItem(originalItem, new CosmosItemRequestOptions()) .onErrorResume(throwable -> - exceptionHandler("Failed to insert item", throwable)) + CosmosDBExceptionUtils.exceptionHandler("Failed to insert item", throwable)) .flatMap(cosmosItemResponse -> { - fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, cosmosItemResponse, null); return Mono.just(toDomainObject(domainType, cosmosItemResponse.properties())); }); @@ -325,9 +323,9 @@ public Mono insert(String containerName, Object objectToSave, PartitionKe .getContainer(containerName) .createItem(originalItem, options) .onErrorResume(throwable -> - exceptionHandler("Failed to insert item", throwable)) + CosmosDBExceptionUtils.exceptionHandler("Failed to insert item", throwable)) .flatMap(cosmosItemResponse -> { - fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, cosmosItemResponse, null); return Mono.just(toDomainObject(domainType, cosmosItemResponse.properties())); }); @@ -368,12 +366,12 @@ public Mono upsert(String containerName, T object, PartitionKey partition .getContainer(containerName) .upsertItem(originalItem, options) .flatMap(cosmosItemResponse -> { - fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, cosmosItemResponse, null); return Mono.just(toDomainObject(domainType, cosmosItemResponse.properties())); }) .onErrorResume(throwable -> - exceptionHandler("Failed to upsert item", throwable)); + CosmosDBExceptionUtils.exceptionHandler("Failed to upsert item", throwable)); } /** @@ -400,10 +398,10 @@ public Mono deleteById(String containerName, Object id, PartitionKey parti .getItem(id.toString(), partitionKey) .delete(options) .doOnNext(cosmosItemResponse -> - fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, cosmosItemResponse, null)) .onErrorResume(throwable -> - exceptionHandler("Failed to delete item", throwable)) + CosmosDBExceptionUtils.exceptionHandler("Failed to delete item", throwable)) .then(); } @@ -430,9 +428,9 @@ public Mono deleteAll(String containerName, String partitionKeyName) { .getContainer(containerName) .queryItems(sqlQuerySpec, options) .onErrorResume(throwable -> - exceptionHandler("Failed to query items", throwable)) + CosmosDBExceptionUtils.exceptionHandler("Failed to query items", throwable)) .flatMap(cosmosItemFeedResponse -> { - fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, null, cosmosItemFeedResponse); return Flux.fromIterable(cosmosItemFeedResponse.results()); }) @@ -442,10 +440,10 @@ public Mono deleteAll(String containerName, String partitionKeyName) { .getItem(cosmosItemProperties.id(), cosmosItemProperties.get(partitionKeyName)) .delete() .doOnNext(cosmosItemResponse -> - fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, cosmosItemResponse, null)) .onErrorResume(throwable -> - exceptionHandler("Failed to delete items", throwable))) + CosmosDBExceptionUtils.exceptionHandler("Failed to delete items", throwable))) .then(); } @@ -558,10 +556,10 @@ private Mono getCountValue(DocumentQuery query, boolean isCrossPartitionQu options.populateQueryMetrics(isPopulateQueryMetrics); return executeQuery(querySpec, containerName, options) - .doOnNext(feedResponse -> fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + .doOnNext(feedResponse -> CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, null, feedResponse)) .onErrorResume(throwable -> - exceptionHandler("Failed to get count value", throwable)) + CosmosDBExceptionUtils.exceptionHandler("Failed to get count value", throwable)) .next() .map(r -> r.results().get(0).getLong(COUNT_VALUE_KEY)); } @@ -573,7 +571,7 @@ private Flux> executeQuery(SqlQuerySpec sqlQu .getContainer(containerName) .queryItems(sqlQuerySpec, options) .onErrorResume(throwable -> - exceptionHandler("Failed to execute query", throwable)); + CosmosDBExceptionUtils.exceptionHandler("Failed to execute query", throwable)); } /** @@ -588,10 +586,10 @@ public void deleteContainer(@NonNull String containerName) { .getContainer(containerName) .delete() .doOnNext(cosmosContainerResponse -> - fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, cosmosContainerResponse, null)) .onErrorResume(throwable -> - exceptionHandler("Failed to delete container", throwable)) + CosmosDBExceptionUtils.exceptionHandler("Failed to delete container", throwable)) .block(); this.containerNameCache.remove(containerName); } @@ -619,12 +617,12 @@ private Flux findItems(@NonNull DocumentQuery query, @NonN .getContainer(containerName) .queryItems(sqlQuerySpec, feedOptions) .flatMap(cosmosItemFeedResponse -> { - fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, null, cosmosItemFeedResponse); return Flux.fromIterable(cosmosItemFeedResponse.results()); }) .onErrorResume(throwable -> - exceptionHandler("Failed to query items", throwable)); + CosmosDBExceptionUtils.exceptionHandler("Failed to query items", throwable)); } private void assertValidId(Object id) { @@ -665,12 +663,12 @@ private Mono deleteItem(@NonNull CosmosItemProperties cosm .getItem(cosmosItemProperties.id(), partitionKey) .delete(options) .map(cosmosItemResponse -> { - fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, + CosmosdbUtils.fillAndProcessResponseDiagnostics(responseDiagnosticsProcessor, cosmosItemResponse, null); return cosmosItemProperties; }) .onErrorResume(throwable -> - exceptionHandler("Failed to delete item", throwable)); + CosmosDBExceptionUtils.exceptionHandler("Failed to delete item", throwable)); } private T toDomainObject(@NonNull Class domainType, CosmosItemProperties cosmosItemProperties) { diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/ResponseDiagnostics.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/ResponseDiagnostics.java similarity index 98% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/ResponseDiagnostics.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/ResponseDiagnostics.java index 316eee94c4f1..c5c990c6b66d 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/ResponseDiagnostics.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/ResponseDiagnostics.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core; +package com.azure.spring.data.cosmos.core; import com.azure.data.cosmos.CosmosResponseDiagnostics; import com.azure.data.cosmos.FeedResponse; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/ResponseDiagnosticsProcessor.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/ResponseDiagnosticsProcessor.java similarity index 93% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/ResponseDiagnosticsProcessor.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/ResponseDiagnosticsProcessor.java index b8407cc36c03..1eb96b409809 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/ResponseDiagnosticsProcessor.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/ResponseDiagnosticsProcessor.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core; +package com.azure.spring.data.cosmos.core; import javax.annotation.Nullable; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/convert/MappingCosmosConverter.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/convert/MappingCosmosConverter.java similarity index 94% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/convert/MappingCosmosConverter.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/convert/MappingCosmosConverter.java index a09e3f8e4de5..8fae263e43d5 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/convert/MappingCosmosConverter.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/convert/MappingCosmosConverter.java @@ -1,14 +1,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core.convert; +package com.azure.spring.data.cosmos.core.convert; import com.azure.data.cosmos.CosmosItemProperties; +import com.azure.spring.data.cosmos.core.mapping.CosmosPersistentProperty; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import com.microsoft.azure.spring.data.cosmosdb.Constants; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.CosmosPersistentEntity; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.CosmosPersistentProperty; -import com.microsoft.azure.spring.data.cosmosdb.exception.CosmosDBAccessException; +import com.azure.spring.data.cosmos.Constants; +import com.azure.spring.data.cosmos.core.mapping.CosmosPersistentEntity; +import com.azure.spring.data.cosmos.exception.CosmosDBAccessException; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.ApplicationContext; @@ -27,7 +27,7 @@ import java.time.format.DateTimeFormatter; import java.util.Date; -import static com.microsoft.azure.spring.data.cosmosdb.Constants.ISO_8601_COMPATIBLE_DATE_PATTERN; +import static com.azure.spring.data.cosmos.Constants.ISO_8601_COMPATIBLE_DATE_PATTERN; /** * A converter class between common types and cosmosItemProperties diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/convert/ObjectMapperFactory.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/convert/ObjectMapperFactory.java similarity index 94% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/convert/ObjectMapperFactory.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/convert/ObjectMapperFactory.java index 7cdef7ced6f3..0a17f100a468 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/convert/ObjectMapperFactory.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/convert/ObjectMapperFactory.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core.convert; +package com.azure.spring.data.cosmos.core.convert; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/convert/package-info.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/convert/package-info.java similarity index 72% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/convert/package-info.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/convert/package-info.java index dc67fc729470..5218f5599bbd 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/convert/package-info.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/convert/package-info.java @@ -4,4 +4,4 @@ /** * This package contains the converter classes of cosmos db */ -package com.microsoft.azure.spring.data.cosmosdb.core.convert; +package com.azure.spring.data.cosmos.core.convert; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/generator/AbstractQueryGenerator.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/generator/AbstractQueryGenerator.java similarity index 95% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/generator/AbstractQueryGenerator.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/generator/AbstractQueryGenerator.java index c28b1f6ed1f8..680ec4045ac5 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/generator/AbstractQueryGenerator.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/generator/AbstractQueryGenerator.java @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core.generator; +package com.azure.spring.data.cosmos.core.generator; import com.azure.data.cosmos.SqlParameterList; import com.azure.data.cosmos.SqlQuerySpec; -import com.microsoft.azure.spring.data.cosmosdb.core.query.Criteria; -import com.microsoft.azure.spring.data.cosmosdb.core.query.CriteriaType; -import com.microsoft.azure.spring.data.cosmosdb.core.query.DocumentQuery; -import com.microsoft.azure.spring.data.cosmosdb.exception.IllegalQueryException; +import com.azure.spring.data.cosmos.core.query.Criteria; +import com.azure.spring.data.cosmos.core.query.CriteriaType; +import com.azure.spring.data.cosmos.core.query.DocumentQuery; +import com.azure.spring.data.cosmos.exception.IllegalQueryException; import org.javatuples.Pair; import org.springframework.data.domain.Sort; import org.springframework.lang.NonNull; @@ -19,7 +19,7 @@ import java.util.List; import java.util.stream.Collectors; -import static com.microsoft.azure.spring.data.cosmosdb.core.convert.MappingCosmosConverter.toCosmosDbValue; +import static com.azure.spring.data.cosmos.core.convert.MappingCosmosConverter.toCosmosDbValue; /** * Base class for generating sql query diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/generator/CountQueryGenerator.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/generator/CountQueryGenerator.java similarity index 75% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/generator/CountQueryGenerator.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/generator/CountQueryGenerator.java index bddecf136e4c..c8f0d25d928f 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/generator/CountQueryGenerator.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/generator/CountQueryGenerator.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core.generator; +package com.azure.spring.data.cosmos.core.generator; import com.azure.data.cosmos.SqlQuerySpec; -import com.microsoft.azure.spring.data.cosmosdb.core.query.DocumentQuery; +import com.azure.spring.data.cosmos.core.query.DocumentQuery; /** * Generate count query diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/generator/FindQuerySpecGenerator.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/generator/FindQuerySpecGenerator.java similarity index 78% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/generator/FindQuerySpecGenerator.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/generator/FindQuerySpecGenerator.java index 3296e23e89b2..ff5e128bead1 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/generator/FindQuerySpecGenerator.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/generator/FindQuerySpecGenerator.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core.generator; +package com.azure.spring.data.cosmos.core.generator; import com.azure.data.cosmos.SqlQuerySpec; -import com.microsoft.azure.spring.data.cosmosdb.core.query.DocumentQuery; +import com.azure.spring.data.cosmos.core.query.DocumentQuery; /** * Generate sql find query diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/generator/QuerySpecGenerator.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/generator/QuerySpecGenerator.java similarity index 76% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/generator/QuerySpecGenerator.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/generator/QuerySpecGenerator.java index a1cf9e8e0e2f..d460d2e266b3 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/generator/QuerySpecGenerator.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/generator/QuerySpecGenerator.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core.generator; +package com.azure.spring.data.cosmos.core.generator; import com.azure.data.cosmos.SqlQuerySpec; -import com.microsoft.azure.spring.data.cosmosdb.core.query.DocumentQuery; +import com.azure.spring.data.cosmos.core.query.DocumentQuery; /** * Interface of generating SqlQuerySpec diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/generator/package-info.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/generator/package-info.java similarity index 71% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/generator/package-info.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/generator/package-info.java index b67e5a92e7e3..4992691e70db 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/generator/package-info.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/generator/package-info.java @@ -4,4 +4,4 @@ /** * This package contains the generator classes of cosmos db */ -package com.microsoft.azure.spring.data.cosmosdb.core.generator; +package com.azure.spring.data.cosmos.core.generator; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/BasicCosmosPersistentEntity.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/BasicCosmosPersistentEntity.java similarity index 96% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/BasicCosmosPersistentEntity.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/BasicCosmosPersistentEntity.java index 89ccc99ada71..b550e9a6239c 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/BasicCosmosPersistentEntity.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/BasicCosmosPersistentEntity.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core.mapping; +package com.azure.spring.data.cosmos.core.mapping; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/BasicCosmosPersistentProperty.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/BasicCosmosPersistentProperty.java similarity index 92% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/BasicCosmosPersistentProperty.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/BasicCosmosPersistentProperty.java index 7b5fd02c173e..092bf4e3b2d8 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/BasicCosmosPersistentProperty.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/BasicCosmosPersistentProperty.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core.mapping; +package com.azure.spring.data.cosmos.core.mapping; -import com.microsoft.azure.spring.data.cosmosdb.Constants; +import com.azure.spring.data.cosmos.Constants; import org.springframework.data.mapping.Association; import org.springframework.data.mapping.model.AnnotationBasedPersistentProperty; import org.springframework.data.mapping.model.Property; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/CosmosMappingContext.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/CosmosMappingContext.java similarity index 96% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/CosmosMappingContext.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/CosmosMappingContext.java index f2c1c7bf2bb4..050aa03cc3f0 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/CosmosMappingContext.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/CosmosMappingContext.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core.mapping; +package com.azure.spring.data.cosmos.core.mapping; import org.springframework.context.ApplicationContext; import org.springframework.data.mapping.context.AbstractMappingContext; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/CosmosPersistentEntity.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/CosmosPersistentEntity.java similarity index 91% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/CosmosPersistentEntity.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/CosmosPersistentEntity.java index 3418648de325..189febbf8ce3 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/CosmosPersistentEntity.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/CosmosPersistentEntity.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core.mapping; +package com.azure.spring.data.cosmos.core.mapping; import org.springframework.data.mapping.PersistentEntity; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/CosmosPersistentProperty.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/CosmosPersistentProperty.java similarity index 83% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/CosmosPersistentProperty.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/CosmosPersistentProperty.java index 31ce39f31037..780b8cbd8137 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/CosmosPersistentProperty.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/CosmosPersistentProperty.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core.mapping; +package com.azure.spring.data.cosmos.core.mapping; import org.springframework.data.mapping.PersistentProperty; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/Document.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/Document.java similarity index 90% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/Document.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/Document.java index 79cd9534e794..3a1740610df5 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/Document.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/Document.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core.mapping; +package com.azure.spring.data.cosmos.core.mapping; -import com.microsoft.azure.spring.data.cosmosdb.Constants; +import com.azure.spring.data.cosmos.Constants; import org.springframework.data.annotation.Persistent; import java.lang.annotation.Inherited; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/DocumentIndexingPolicy.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/DocumentIndexingPolicy.java similarity index 90% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/DocumentIndexingPolicy.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/DocumentIndexingPolicy.java index e578cdb40933..1e794e2d14e6 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/DocumentIndexingPolicy.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/DocumentIndexingPolicy.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core.mapping; +package com.azure.spring.data.cosmos.core.mapping; import com.azure.data.cosmos.IndexingMode; -import com.microsoft.azure.spring.data.cosmosdb.Constants; +import com.azure.spring.data.cosmos.Constants; import org.springframework.data.annotation.Persistent; import java.lang.annotation.Inherited; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/PartitionKey.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/PartitionKey.java similarity index 91% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/PartitionKey.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/PartitionKey.java index 6ae69dd61509..680b06ec2471 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/PartitionKey.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/PartitionKey.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core.mapping; +package com.azure.spring.data.cosmos.core.mapping; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/package-info.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/package-info.java similarity index 74% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/package-info.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/package-info.java index e7a0f48b4da8..673ed782e383 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/package-info.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/package-info.java @@ -4,4 +4,4 @@ /** * This package contains the mapping classes of cosmos persistent entities */ -package com.microsoft.azure.spring.data.cosmosdb.core.mapping; +package com.azure.spring.data.cosmos.core.mapping; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/package-info.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/package-info.java similarity index 80% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/package-info.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/package-info.java index 0a5a2dee562e..e198fccd1791 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/package-info.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/package-info.java @@ -5,4 +5,4 @@ * This package contains the core classes of cosmos db, includes converters, * query generators and mapping to cosmos entities */ -package com.microsoft.azure.spring.data.cosmosdb.core; +package com.azure.spring.data.cosmos.core; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/query/CosmosPageImpl.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/query/CosmosPageImpl.java similarity index 97% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/query/CosmosPageImpl.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/query/CosmosPageImpl.java index 771e53910e51..2a7ba3a1d1f0 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/query/CosmosPageImpl.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/query/CosmosPageImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core.query; +package com.azure.spring.data.cosmos.core.query; import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.Pageable; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/query/CosmosPageRequest.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/query/CosmosPageRequest.java similarity index 98% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/query/CosmosPageRequest.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/query/CosmosPageRequest.java index 68d98dea0c30..5f42092af3c3 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/query/CosmosPageRequest.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/query/CosmosPageRequest.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core.query; +package com.azure.spring.data.cosmos.core.query; import com.azure.data.cosmos.FeedResponse; import org.springframework.data.domain.PageRequest; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/query/Criteria.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/query/Criteria.java similarity index 97% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/query/Criteria.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/query/Criteria.java index 5a0d7b8c5a31..0028d67f5379 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/query/Criteria.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/query/Criteria.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core.query; +package com.azure.spring.data.cosmos.core.query; import org.springframework.lang.NonNull; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/query/CriteriaType.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/query/CriteriaType.java similarity index 98% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/query/CriteriaType.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/query/CriteriaType.java index caf6c927875e..153a76b94909 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/query/CriteriaType.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/query/CriteriaType.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core.query; +package com.azure.spring.data.cosmos.core.query; import org.springframework.lang.NonNull; import org.springframework.data.repository.query.parser.Part; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/query/DocumentQuery.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/query/DocumentQuery.java similarity index 98% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/query/DocumentQuery.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/query/DocumentQuery.java index 8adfb92d93b7..9bced79adc02 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/query/DocumentQuery.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/query/DocumentQuery.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core.query; +package com.azure.spring.data.cosmos.core.query; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/query/package-info.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/query/package-info.java similarity index 73% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/query/package-info.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/query/package-info.java index bbd03f8b278f..c1c80354c766 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/core/query/package-info.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/query/package-info.java @@ -4,4 +4,4 @@ /** * This package contains the query classes of cosmos db document */ -package com.microsoft.azure.spring.data.cosmosdb.core.query; +package com.azure.spring.data.cosmos.core.query; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/exception/ConfigurationException.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/exception/ConfigurationException.java similarity index 93% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/exception/ConfigurationException.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/exception/ConfigurationException.java index 3aea8e557a7f..f6bd7e1bf6c7 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/exception/ConfigurationException.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/exception/ConfigurationException.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.exception; +package com.azure.spring.data.cosmos.exception; import org.springframework.dao.DataAccessException; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/exception/CosmosDBAccessException.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/exception/CosmosDBAccessException.java similarity index 89% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/exception/CosmosDBAccessException.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/exception/CosmosDBAccessException.java index f20791008ab8..0a0d29725f39 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/exception/CosmosDBAccessException.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/exception/CosmosDBAccessException.java @@ -1,15 +1,17 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.exception; +package com.azure.spring.data.cosmos.exception; import com.azure.data.cosmos.CosmosClientException; +import com.azure.spring.data.cosmos.repository.CosmosRepository; +import com.azure.spring.data.cosmos.repository.ReactiveCosmosRepository; import org.springframework.dao.DataAccessException; import org.springframework.lang.Nullable; /** * Public class extending DataAccessException, exposes innerException. - * Every API in {@link com.microsoft.azure.spring.data.cosmosdb.repository.CosmosRepository} - * and {@link com.microsoft.azure.spring.data.cosmosdb.repository.ReactiveCosmosRepository} + * Every API in {@link CosmosRepository} + * and {@link ReactiveCosmosRepository} * should throw {@link CosmosDBAccessException}. * innerException refers to the exception thrown by CosmosDB SDK. Callers of repository APIs can * rely on innerException for any retriable logic, or for more details on the failure of diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/exception/CosmosDBExceptionUtils.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/exception/CosmosDBExceptionUtils.java similarity index 97% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/exception/CosmosDBExceptionUtils.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/exception/CosmosDBExceptionUtils.java index 4e11eca0c4e6..84c1dfae68ca 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/exception/CosmosDBExceptionUtils.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/exception/CosmosDBExceptionUtils.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.exception; +package com.azure.spring.data.cosmos.exception; import com.azure.data.cosmos.CosmosClientException; import com.azure.data.cosmos.internal.HttpConstants; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/exception/DatabaseCreationException.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/exception/DatabaseCreationException.java similarity index 93% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/exception/DatabaseCreationException.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/exception/DatabaseCreationException.java index d0230725cf97..0e3968dc4770 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/exception/DatabaseCreationException.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/exception/DatabaseCreationException.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.exception; +package com.azure.spring.data.cosmos.exception; import org.springframework.dao.DataAccessException; import org.springframework.lang.Nullable; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/exception/IllegalCollectionException.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/exception/IllegalCollectionException.java similarity index 93% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/exception/IllegalCollectionException.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/exception/IllegalCollectionException.java index c447f2d5d291..0344ff842f50 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/exception/IllegalCollectionException.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/exception/IllegalCollectionException.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.exception; +package com.azure.spring.data.cosmos.exception; import org.springframework.dao.DataAccessException; import org.springframework.lang.Nullable; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/exception/IllegalQueryException.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/exception/IllegalQueryException.java similarity index 93% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/exception/IllegalQueryException.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/exception/IllegalQueryException.java index 75c33a0bb5e9..59c95cb9c5af 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/exception/IllegalQueryException.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/exception/IllegalQueryException.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.exception; +package com.azure.spring.data.cosmos.exception; import org.springframework.dao.DataAccessException; import org.springframework.lang.Nullable; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/exception/package-info.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/exception/package-info.java similarity index 73% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/exception/package-info.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/exception/package-info.java index a420e54064b7..3094644570a7 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/exception/package-info.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/exception/package-info.java @@ -4,4 +4,4 @@ /** * This package contains the exception classes of cosmos db */ -package com.microsoft.azure.spring.data.cosmosdb.exception; +package com.azure.spring.data.cosmos.exception; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/package-info.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/package-info.java similarity index 72% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/package-info.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/package-info.java index 12dc2276157d..04018a5aed64 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/package-info.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/package-info.java @@ -4,4 +4,4 @@ /** * Cosmosdb class for spring */ -package com.microsoft.azure.spring.data.cosmosdb; +package com.azure.spring.data.cosmos; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/CosmosRepository.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/CosmosRepository.java similarity index 96% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/CosmosRepository.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/CosmosRepository.java index 85274905a3c1..2591d8502cda 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/CosmosRepository.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/CosmosRepository.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository; +package com.azure.spring.data.cosmos.repository; import com.azure.data.cosmos.PartitionKey; import org.springframework.data.repository.NoRepositoryBean; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/ReactiveCosmosRepository.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/ReactiveCosmosRepository.java similarity index 96% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/ReactiveCosmosRepository.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/ReactiveCosmosRepository.java index b963adc03fcd..4b35604e0f3a 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/ReactiveCosmosRepository.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/ReactiveCosmosRepository.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository; +package com.azure.spring.data.cosmos.repository; import com.azure.data.cosmos.PartitionKey; import org.springframework.data.repository.NoRepositoryBean; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/CosmosRepositoriesRegistrar.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/config/CosmosRepositoriesRegistrar.java similarity index 92% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/CosmosRepositoriesRegistrar.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/config/CosmosRepositoriesRegistrar.java index ba20dd279785..9975dfbf92b2 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/CosmosRepositoriesRegistrar.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/config/CosmosRepositoriesRegistrar.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.config; +package com.azure.spring.data.cosmos.repository.config; import org.springframework.data.repository.config.RepositoryBeanDefinitionRegistrarSupport; import org.springframework.data.repository.config.RepositoryConfigurationExtension; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/CosmosRepositoryConfigurationExtension.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/config/CosmosRepositoryConfigurationExtension.java similarity index 88% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/CosmosRepositoryConfigurationExtension.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/config/CosmosRepositoryConfigurationExtension.java index 2c479f88887b..20466b923177 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/CosmosRepositoryConfigurationExtension.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/config/CosmosRepositoryConfigurationExtension.java @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.config; +package com.azure.spring.data.cosmos.repository.config; -import com.microsoft.azure.spring.data.cosmosdb.Constants; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.CosmosMappingContext; -import com.microsoft.azure.spring.data.cosmosdb.repository.CosmosRepository; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosRepositoryFactoryBean; +import com.azure.spring.data.cosmos.repository.support.CosmosRepositoryFactoryBean; +import com.azure.spring.data.cosmos.Constants; +import com.azure.spring.data.cosmos.core.mapping.CosmosMappingContext; +import com.azure.spring.data.cosmos.repository.CosmosRepository; import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.support.BeanDefinitionRegistry; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/EnableCosmosRepositories.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/config/EnableCosmosRepositories.java similarity index 91% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/EnableCosmosRepositories.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/config/EnableCosmosRepositories.java index 14eca6637790..5ac564c4aac2 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/EnableCosmosRepositories.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/config/EnableCosmosRepositories.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.config; +package com.azure.spring.data.cosmos.repository.config; -import com.microsoft.azure.spring.data.cosmosdb.Constants; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosRepositoryFactoryBean; +import com.azure.spring.data.cosmos.repository.support.CosmosRepositoryFactoryBean; +import com.azure.spring.data.cosmos.Constants; import org.springframework.context.annotation.ComponentScan.Filter; import org.springframework.context.annotation.Import; import org.springframework.data.repository.config.DefaultRepositoryBaseClass; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/EnableReactiveCosmosRepositories.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/config/EnableReactiveCosmosRepositories.java similarity index 91% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/EnableReactiveCosmosRepositories.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/config/EnableReactiveCosmosRepositories.java index 7eb05a311832..c1c9d5aae91b 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/EnableReactiveCosmosRepositories.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/config/EnableReactiveCosmosRepositories.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.config; +package com.azure.spring.data.cosmos.repository.config; -import com.microsoft.azure.spring.data.cosmosdb.Constants; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.ReactiveCosmosRepositoryFactoryBean; +import com.azure.spring.data.cosmos.repository.support.ReactiveCosmosRepositoryFactoryBean; +import com.azure.spring.data.cosmos.Constants; import org.springframework.context.annotation.ComponentScan.Filter; import org.springframework.context.annotation.Import; import org.springframework.data.repository.config.DefaultRepositoryBaseClass; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/ReactiveCosmosRepositoriesRegistrar.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/config/ReactiveCosmosRepositoriesRegistrar.java similarity index 92% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/ReactiveCosmosRepositoriesRegistrar.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/config/ReactiveCosmosRepositoriesRegistrar.java index bbcb6b2b84f4..60b59a81726a 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/ReactiveCosmosRepositoriesRegistrar.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/config/ReactiveCosmosRepositoriesRegistrar.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.config; +package com.azure.spring.data.cosmos.repository.config; import org.springframework.data.repository.config.RepositoryBeanDefinitionRegistrarSupport; import org.springframework.data.repository.config.RepositoryConfigurationExtension; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/ReactiveCosmosRepositoryConfigurationExtension.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/config/ReactiveCosmosRepositoryConfigurationExtension.java similarity index 87% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/ReactiveCosmosRepositoryConfigurationExtension.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/config/ReactiveCosmosRepositoryConfigurationExtension.java index e9a5b87faa59..c195bc1339f9 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/ReactiveCosmosRepositoryConfigurationExtension.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/config/ReactiveCosmosRepositoryConfigurationExtension.java @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.config; +package com.azure.spring.data.cosmos.repository.config; -import com.microsoft.azure.spring.data.cosmosdb.Constants; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.CosmosMappingContext; -import com.microsoft.azure.spring.data.cosmosdb.repository.ReactiveCosmosRepository; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.ReactiveCosmosRepositoryFactoryBean; +import com.azure.spring.data.cosmos.repository.support.ReactiveCosmosRepositoryFactoryBean; +import com.azure.spring.data.cosmos.Constants; +import com.azure.spring.data.cosmos.core.mapping.CosmosMappingContext; +import com.azure.spring.data.cosmos.repository.ReactiveCosmosRepository; import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.support.BeanDefinitionRegistry; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/package-info.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/config/package-info.java similarity index 73% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/package-info.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/config/package-info.java index 7891cc7d30ad..1a285bce2557 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/package-info.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/config/package-info.java @@ -4,4 +4,4 @@ /** * This package contains the config classes of setting up cosmosdb repositories */ -package com.microsoft.azure.spring.data.cosmosdb.repository.config; +package com.azure.spring.data.cosmos.repository.config; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/package-info.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/package-info.java similarity index 76% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/package-info.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/package-info.java index fa885616b308..18d6925d30f9 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/package-info.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/package-info.java @@ -4,4 +4,4 @@ /** * This package contains the support, query and config classes of setting up cosmosdb repositories */ -package com.microsoft.azure.spring.data.cosmosdb.repository; +package com.azure.spring.data.cosmos.repository; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/AbstractCosmosQuery.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/AbstractCosmosQuery.java similarity index 91% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/AbstractCosmosQuery.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/AbstractCosmosQuery.java index 55e012d185e6..36090a3653f4 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/AbstractCosmosQuery.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/AbstractCosmosQuery.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.query; +package com.azure.spring.data.cosmos.repository.query; -import com.microsoft.azure.spring.data.cosmosdb.core.CosmosOperations; -import com.microsoft.azure.spring.data.cosmosdb.core.query.DocumentQuery; +import com.azure.spring.data.cosmos.core.CosmosOperations; +import com.azure.spring.data.cosmos.core.query.DocumentQuery; import org.springframework.data.repository.query.RepositoryQuery; import org.springframework.data.repository.query.ResultProcessor; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/AbstractReactiveCosmosQuery.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/AbstractReactiveCosmosQuery.java similarity index 92% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/AbstractReactiveCosmosQuery.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/AbstractReactiveCosmosQuery.java index 8b0d92e6f18a..5d98980e2357 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/AbstractReactiveCosmosQuery.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/AbstractReactiveCosmosQuery.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.query; +package com.azure.spring.data.cosmos.repository.query; -import com.microsoft.azure.spring.data.cosmosdb.core.ReactiveCosmosOperations; -import com.microsoft.azure.spring.data.cosmosdb.core.query.DocumentQuery; +import com.azure.spring.data.cosmos.core.ReactiveCosmosOperations; +import com.azure.spring.data.cosmos.core.query.DocumentQuery; import org.springframework.data.repository.query.RepositoryQuery; import org.springframework.data.repository.query.ResultProcessor; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/CosmosEntityMetadata.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/CosmosEntityMetadata.java similarity index 90% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/CosmosEntityMetadata.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/CosmosEntityMetadata.java index af36f066e50f..db59937c5738 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/CosmosEntityMetadata.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/CosmosEntityMetadata.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.query; +package com.azure.spring.data.cosmos.repository.query; import org.springframework.data.repository.core.EntityMetadata; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/CosmosParameter.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/CosmosParameter.java similarity index 90% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/CosmosParameter.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/CosmosParameter.java index d667df89a993..90a3dddc2986 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/CosmosParameter.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/CosmosParameter.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.query; +package com.azure.spring.data.cosmos.repository.query; import org.springframework.core.MethodParameter; import org.springframework.data.repository.query.Parameter; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/CosmosParameterAccessor.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/CosmosParameterAccessor.java similarity index 87% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/CosmosParameterAccessor.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/CosmosParameterAccessor.java index 0cb40ad1db77..9f112e1084e3 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/CosmosParameterAccessor.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/CosmosParameterAccessor.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.query; +package com.azure.spring.data.cosmos.repository.query; import org.springframework.data.repository.query.ParameterAccessor; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/CosmosParameterParameterAccessor.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/CosmosParameterParameterAccessor.java similarity index 93% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/CosmosParameterParameterAccessor.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/CosmosParameterParameterAccessor.java index 2ce2d081ec3e..57da9662636c 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/CosmosParameterParameterAccessor.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/CosmosParameterParameterAccessor.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.query; +package com.azure.spring.data.cosmos.repository.query; import org.springframework.data.repository.query.ParametersParameterAccessor; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/CosmosParameters.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/CosmosParameters.java similarity index 94% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/CosmosParameters.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/CosmosParameters.java index 55386969f85d..4ed1187a7969 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/CosmosParameters.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/CosmosParameters.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.query; +package com.azure.spring.data.cosmos.repository.query; import org.springframework.core.MethodParameter; import org.springframework.data.repository.query.Parameters; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/CosmosQueryCreator.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/CosmosQueryCreator.java similarity index 87% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/CosmosQueryCreator.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/CosmosQueryCreator.java index 828917f1b2d1..ceafd6096c32 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/CosmosQueryCreator.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/CosmosQueryCreator.java @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.query; - -import com.microsoft.azure.spring.data.cosmosdb.Constants; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.CosmosPersistentProperty; -import com.microsoft.azure.spring.data.cosmosdb.core.query.Criteria; -import com.microsoft.azure.spring.data.cosmosdb.core.query.CriteriaType; -import com.microsoft.azure.spring.data.cosmosdb.core.query.DocumentQuery; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; +package com.azure.spring.data.cosmos.repository.query; + +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.Constants; +import com.azure.spring.data.cosmos.core.mapping.CosmosPersistentProperty; +import com.azure.spring.data.cosmos.core.query.Criteria; +import com.azure.spring.data.cosmos.core.query.CriteriaType; +import com.azure.spring.data.cosmos.core.query.DocumentQuery; import org.springframework.data.domain.Sort; import org.springframework.data.mapping.context.MappingContext; import org.springframework.data.repository.query.parser.AbstractQueryCreator; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/CosmosQueryExecution.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/CosmosQueryExecution.java similarity index 92% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/CosmosQueryExecution.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/CosmosQueryExecution.java index 6d3ae6f3ed6f..0306e8c2e4c3 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/CosmosQueryExecution.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/CosmosQueryExecution.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.query; +package com.azure.spring.data.cosmos.repository.query; -import com.microsoft.azure.spring.data.cosmosdb.core.CosmosOperations; -import com.microsoft.azure.spring.data.cosmosdb.core.query.CosmosPageRequest; -import com.microsoft.azure.spring.data.cosmosdb.core.query.DocumentQuery; +import com.azure.spring.data.cosmos.core.CosmosOperations; +import com.azure.spring.data.cosmos.core.query.CosmosPageRequest; +import com.azure.spring.data.cosmos.core.query.DocumentQuery; import org.springframework.data.domain.Pageable; /** diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/CosmosQueryMethod.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/CosmosQueryMethod.java similarity index 90% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/CosmosQueryMethod.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/CosmosQueryMethod.java index 033b38282c9e..ebce667e0520 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/CosmosQueryMethod.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/CosmosQueryMethod.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.query; +package com.azure.spring.data.cosmos.repository.query; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; import org.springframework.data.projection.ProjectionFactory; import org.springframework.data.repository.core.EntityMetadata; import org.springframework.data.repository.core.RepositoryMetadata; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/PartTreeCosmosQuery.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/PartTreeCosmosQuery.java similarity index 86% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/PartTreeCosmosQuery.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/PartTreeCosmosQuery.java index 6618f5528ef3..ad4d06a2c777 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/PartTreeCosmosQuery.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/PartTreeCosmosQuery.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.query; +package com.azure.spring.data.cosmos.repository.query; -import com.microsoft.azure.spring.data.cosmosdb.core.CosmosOperations; -import com.microsoft.azure.spring.data.cosmosdb.core.query.DocumentQuery; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.CosmosPersistentProperty; +import com.azure.spring.data.cosmos.core.CosmosOperations; +import com.azure.spring.data.cosmos.core.query.DocumentQuery; +import com.azure.spring.data.cosmos.core.mapping.CosmosPersistentProperty; import org.apache.commons.lang3.NotImplementedException; import org.springframework.data.mapping.context.MappingContext; import org.springframework.data.repository.query.ResultProcessor; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/PartTreeReactiveCosmosQuery.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/PartTreeReactiveCosmosQuery.java similarity index 86% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/PartTreeReactiveCosmosQuery.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/PartTreeReactiveCosmosQuery.java index 7ee24913e199..0611a21b5cc7 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/PartTreeReactiveCosmosQuery.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/PartTreeReactiveCosmosQuery.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.query; +package com.azure.spring.data.cosmos.repository.query; -import com.microsoft.azure.spring.data.cosmosdb.core.ReactiveCosmosOperations; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.CosmosPersistentProperty; -import com.microsoft.azure.spring.data.cosmosdb.core.query.DocumentQuery; +import com.azure.spring.data.cosmos.core.ReactiveCosmosOperations; +import com.azure.spring.data.cosmos.core.mapping.CosmosPersistentProperty; +import com.azure.spring.data.cosmos.core.query.DocumentQuery; import org.apache.commons.lang3.NotImplementedException; import org.springframework.data.mapping.context.MappingContext; import org.springframework.data.repository.query.ResultProcessor; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/ReactiveCosmosEntityMetadata.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/ReactiveCosmosEntityMetadata.java similarity index 90% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/ReactiveCosmosEntityMetadata.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/ReactiveCosmosEntityMetadata.java index 62c6b844e12a..d7adefad76fc 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/ReactiveCosmosEntityMetadata.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/ReactiveCosmosEntityMetadata.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.query; +package com.azure.spring.data.cosmos.repository.query; import org.springframework.data.repository.core.EntityMetadata; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/ReactiveCosmosParameterAccessor.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/ReactiveCosmosParameterAccessor.java similarity index 87% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/ReactiveCosmosParameterAccessor.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/ReactiveCosmosParameterAccessor.java index fc90b7d55de1..9222078ea1a2 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/ReactiveCosmosParameterAccessor.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/ReactiveCosmosParameterAccessor.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.query; +package com.azure.spring.data.cosmos.repository.query; import org.springframework.data.repository.query.ParameterAccessor; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/ReactiveCosmosParameterParameterAccessor.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/ReactiveCosmosParameterParameterAccessor.java similarity index 94% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/ReactiveCosmosParameterParameterAccessor.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/ReactiveCosmosParameterParameterAccessor.java index 9d31c6381d32..979314e13c46 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/ReactiveCosmosParameterParameterAccessor.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/ReactiveCosmosParameterParameterAccessor.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.query; +package com.azure.spring.data.cosmos.repository.query; import org.springframework.data.repository.query.ParametersParameterAccessor; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/ReactiveCosmosQueryCreator.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/ReactiveCosmosQueryCreator.java similarity index 87% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/ReactiveCosmosQueryCreator.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/ReactiveCosmosQueryCreator.java index be36e333bcf7..300651feefff 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/ReactiveCosmosQueryCreator.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/ReactiveCosmosQueryCreator.java @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.query; - -import com.microsoft.azure.spring.data.cosmosdb.Constants; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.CosmosPersistentProperty; -import com.microsoft.azure.spring.data.cosmosdb.core.query.Criteria; -import com.microsoft.azure.spring.data.cosmosdb.core.query.CriteriaType; -import com.microsoft.azure.spring.data.cosmosdb.core.query.DocumentQuery; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; +package com.azure.spring.data.cosmos.repository.query; + +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.Constants; +import com.azure.spring.data.cosmos.core.mapping.CosmosPersistentProperty; +import com.azure.spring.data.cosmos.core.query.Criteria; +import com.azure.spring.data.cosmos.core.query.CriteriaType; +import com.azure.spring.data.cosmos.core.query.DocumentQuery; import org.springframework.data.domain.Sort; import org.springframework.data.mapping.context.MappingContext; import org.springframework.data.repository.query.parser.AbstractQueryCreator; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/ReactiveCosmosQueryExecution.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/ReactiveCosmosQueryExecution.java similarity index 92% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/ReactiveCosmosQueryExecution.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/ReactiveCosmosQueryExecution.java index bf615fae2dbe..ec1546046c3f 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/ReactiveCosmosQueryExecution.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/ReactiveCosmosQueryExecution.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.query; +package com.azure.spring.data.cosmos.repository.query; -import com.microsoft.azure.spring.data.cosmosdb.core.ReactiveCosmosOperations; -import com.microsoft.azure.spring.data.cosmosdb.core.query.DocumentQuery; +import com.azure.spring.data.cosmos.core.ReactiveCosmosOperations; +import com.azure.spring.data.cosmos.core.query.DocumentQuery; /** * Interface to execute reactive cosmos query operations diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/ReactiveCosmosQueryMethod.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/ReactiveCosmosQueryMethod.java similarity index 90% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/ReactiveCosmosQueryMethod.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/ReactiveCosmosQueryMethod.java index 288fa02d7564..9ef769b4c9ad 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/ReactiveCosmosQueryMethod.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/ReactiveCosmosQueryMethod.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.query; +package com.azure.spring.data.cosmos.repository.query; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; import org.springframework.data.projection.ProjectionFactory; import org.springframework.data.repository.core.EntityMetadata; import org.springframework.data.repository.core.RepositoryMetadata; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/SimpleCosmosEntityMetadata.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/SimpleCosmosEntityMetadata.java similarity index 90% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/SimpleCosmosEntityMetadata.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/SimpleCosmosEntityMetadata.java index c027a1bc7a50..45658a1df22a 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/SimpleCosmosEntityMetadata.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/SimpleCosmosEntityMetadata.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.query; +package com.azure.spring.data.cosmos.repository.query; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; import org.springframework.util.Assert; /** diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/SimpleReactiveCosmosEntityMetadata.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/SimpleReactiveCosmosEntityMetadata.java similarity index 90% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/SimpleReactiveCosmosEntityMetadata.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/SimpleReactiveCosmosEntityMetadata.java index 36294fcdc6ec..f1f34110daaf 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/SimpleReactiveCosmosEntityMetadata.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/SimpleReactiveCosmosEntityMetadata.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.query; +package com.azure.spring.data.cosmos.repository.query; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; import org.springframework.util.Assert; /** diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/package-info.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/package-info.java similarity index 70% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/package-info.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/package-info.java index 18fb93d32872..7d75b179a800 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/query/package-info.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/query/package-info.java @@ -4,4 +4,4 @@ /** * This package contains the process cosmos queries */ -package com.microsoft.azure.spring.data.cosmosdb.repository.query; +package com.azure.spring.data.cosmos.repository.query; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/CosmosEntityInformation.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/CosmosEntityInformation.java similarity index 96% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/CosmosEntityInformation.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/CosmosEntityInformation.java index 14dd833c76bc..940e9e91b751 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/CosmosEntityInformation.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/CosmosEntityInformation.java @@ -1,16 +1,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.support; +package com.azure.spring.data.cosmos.repository.support; import com.azure.data.cosmos.ExcludedPath; import com.azure.data.cosmos.IncludedPath; import com.azure.data.cosmos.IndexingMode; import com.azure.data.cosmos.IndexingPolicy; -import com.microsoft.azure.spring.data.cosmosdb.Constants; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.Document; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.DocumentIndexingPolicy; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.PartitionKey; +import com.azure.spring.data.cosmos.Constants; +import com.azure.spring.data.cosmos.core.mapping.Document; +import com.azure.spring.data.cosmos.core.mapping.DocumentIndexingPolicy; +import com.azure.spring.data.cosmos.core.mapping.PartitionKey; import org.apache.commons.lang3.reflect.FieldUtils; import org.json.JSONObject; @@ -20,7 +20,7 @@ import org.springframework.lang.NonNull; import org.springframework.util.ReflectionUtils; -import static com.microsoft.azure.spring.data.cosmosdb.common.ExpressionResolver.resolveExpression; +import static com.azure.spring.data.cosmos.common.ExpressionResolver.resolveExpression; import java.lang.reflect.Field; import java.util.ArrayList; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/CosmosRepositoryFactory.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/CosmosRepositoryFactory.java similarity index 91% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/CosmosRepositoryFactory.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/CosmosRepositoryFactory.java index 2ca611f65cd5..924aa773ed49 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/CosmosRepositoryFactory.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/CosmosRepositoryFactory.java @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.support; +package com.azure.spring.data.cosmos.repository.support; -import com.microsoft.azure.spring.data.cosmosdb.core.CosmosOperations; -import com.microsoft.azure.spring.data.cosmosdb.repository.query.CosmosQueryMethod; -import com.microsoft.azure.spring.data.cosmosdb.repository.query.PartTreeCosmosQuery; +import com.azure.spring.data.cosmos.core.CosmosOperations; +import com.azure.spring.data.cosmos.repository.query.CosmosQueryMethod; +import com.azure.spring.data.cosmos.repository.query.PartTreeCosmosQuery; import org.springframework.context.ApplicationContext; import org.springframework.data.projection.ProjectionFactory; import org.springframework.data.repository.core.EntityInformation; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/CosmosRepositoryFactoryBean.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/CosmosRepositoryFactoryBean.java similarity index 92% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/CosmosRepositoryFactoryBean.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/CosmosRepositoryFactoryBean.java index 717c9c499b04..93c62e6294e2 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/CosmosRepositoryFactoryBean.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/CosmosRepositoryFactoryBean.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.support; +package com.azure.spring.data.cosmos.repository.support; -import com.microsoft.azure.spring.data.cosmosdb.core.CosmosOperations; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.CosmosMappingContext; +import com.azure.spring.data.cosmos.core.CosmosOperations; +import com.azure.spring.data.cosmos.core.mapping.CosmosMappingContext; import org.springframework.beans.BeansException; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.annotation.Autowired; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/ReactiveCosmosRepositoryFactory.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/ReactiveCosmosRepositoryFactory.java similarity index 91% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/ReactiveCosmosRepositoryFactory.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/ReactiveCosmosRepositoryFactory.java index 7ba254bf0d80..6b13c5f98c00 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/ReactiveCosmosRepositoryFactory.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/ReactiveCosmosRepositoryFactory.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.support; +package com.azure.spring.data.cosmos.repository.support; -import com.microsoft.azure.spring.data.cosmosdb.core.ReactiveCosmosOperations; -import com.microsoft.azure.spring.data.cosmosdb.repository.query.PartTreeReactiveCosmosQuery; -import com.microsoft.azure.spring.data.cosmosdb.repository.query.ReactiveCosmosQueryMethod; +import com.azure.spring.data.cosmos.core.ReactiveCosmosOperations; +import com.azure.spring.data.cosmos.repository.query.PartTreeReactiveCosmosQuery; +import com.azure.spring.data.cosmos.repository.query.ReactiveCosmosQueryMethod; import org.springframework.context.ApplicationContext; import org.springframework.data.projection.ProjectionFactory; import org.springframework.data.repository.core.EntityInformation; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/ReactiveCosmosRepositoryFactoryBean.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/ReactiveCosmosRepositoryFactoryBean.java similarity index 92% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/ReactiveCosmosRepositoryFactoryBean.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/ReactiveCosmosRepositoryFactoryBean.java index 2e23b3f81acd..20b191d066f2 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/ReactiveCosmosRepositoryFactoryBean.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/ReactiveCosmosRepositoryFactoryBean.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.support; +package com.azure.spring.data.cosmos.repository.support; -import com.microsoft.azure.spring.data.cosmosdb.core.ReactiveCosmosOperations; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.CosmosMappingContext; +import com.azure.spring.data.cosmos.core.ReactiveCosmosOperations; +import com.azure.spring.data.cosmos.core.mapping.CosmosMappingContext; import org.springframework.beans.BeansException; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.annotation.Autowired; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/SimpleCosmosRepository.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/SimpleCosmosRepository.java similarity index 95% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/SimpleCosmosRepository.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/SimpleCosmosRepository.java index 92689a1e4f8e..ecf21da9d110 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/SimpleCosmosRepository.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/SimpleCosmosRepository.java @@ -1,15 +1,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.support; +package com.azure.spring.data.cosmos.repository.support; import com.azure.data.cosmos.CosmosContainerProperties; import com.azure.data.cosmos.PartitionKey; -import com.microsoft.azure.spring.data.cosmosdb.core.CosmosOperations; -import com.microsoft.azure.spring.data.cosmosdb.core.query.Criteria; -import com.microsoft.azure.spring.data.cosmosdb.core.query.CriteriaType; -import com.microsoft.azure.spring.data.cosmosdb.core.query.DocumentQuery; -import com.microsoft.azure.spring.data.cosmosdb.repository.CosmosRepository; +import com.azure.spring.data.cosmos.core.CosmosOperations; +import com.azure.spring.data.cosmos.core.query.Criteria; +import com.azure.spring.data.cosmos.core.query.CriteriaType; +import com.azure.spring.data.cosmos.core.query.DocumentQuery; +import com.azure.spring.data.cosmos.repository.CosmosRepository; import org.springframework.context.ApplicationContext; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/SimpleReactiveCosmosRepository.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/SimpleReactiveCosmosRepository.java similarity index 94% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/SimpleReactiveCosmosRepository.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/SimpleReactiveCosmosRepository.java index fa57ae3925cd..27bfe9652107 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/SimpleReactiveCosmosRepository.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/SimpleReactiveCosmosRepository.java @@ -1,14 +1,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.support; +package com.azure.spring.data.cosmos.repository.support; import com.azure.data.cosmos.CosmosContainerResponse; import com.azure.data.cosmos.PartitionKey; -import com.microsoft.azure.spring.data.cosmosdb.core.ReactiveCosmosOperations; -import com.microsoft.azure.spring.data.cosmosdb.core.query.Criteria; -import com.microsoft.azure.spring.data.cosmosdb.core.query.CriteriaType; -import com.microsoft.azure.spring.data.cosmosdb.core.query.DocumentQuery; -import com.microsoft.azure.spring.data.cosmosdb.repository.ReactiveCosmosRepository; +import com.azure.spring.data.cosmos.core.ReactiveCosmosOperations; +import com.azure.spring.data.cosmos.core.query.Criteria; +import com.azure.spring.data.cosmos.core.query.CriteriaType; +import com.azure.spring.data.cosmos.core.query.DocumentQuery; +import com.azure.spring.data.cosmos.repository.ReactiveCosmosRepository; import org.reactivestreams.Publisher; import org.springframework.context.ApplicationContext; import org.springframework.data.domain.Sort; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/package-info.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/package-info.java similarity index 74% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/package-info.java rename to sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/package-info.java index 55c98f6a55cb..9e71adafb2cd 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/package-info.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/package-info.java @@ -4,4 +4,4 @@ /** * This package contains the support classes of setting up cosmosdb repositories and factories */ -package com.microsoft.azure.spring.data.cosmosdb.repository.support; +package com.azure.spring.data.cosmos.repository.support; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/resources/META-INF/project.properties b/sdk/cosmos/azure-spring-data-cosmos/src/main/resources/META-INF/project.properties similarity index 100% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/resources/META-INF/project.properties rename to sdk/cosmos/azure-spring-data-cosmos/src/main/resources/META-INF/project.properties diff --git a/sdk/cosmos/azure-spring-data-cosmos/src/main/resources/META-INF/spring.factories b/sdk/cosmos/azure-spring-data-cosmos/src/main/resources/META-INF/spring.factories new file mode 100644 index 000000000000..2b697a960e43 --- /dev/null +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/resources/META-INF/spring.factories @@ -0,0 +1 @@ +org.springframework.data.repository.core.support.RepositoryFactorySupport=com.azure.spring.data.cosmos.repository.support.CosmosRepositoryFactory \ No newline at end of file diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/resources/telemetry.config b/sdk/cosmos/azure-spring-data-cosmos/src/main/resources/telemetry.config similarity index 100% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/main/resources/telemetry.config rename to sdk/cosmos/azure-spring-data-cosmos/src/main/resources/telemetry.config diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/CosmosDbFactoryTestIT.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/CosmosDbFactoryTestIT.java similarity index 67% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/CosmosDbFactoryTestIT.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/CosmosDbFactoryTestIT.java index cd027302ec74..b1f853dbe403 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/CosmosDbFactoryTestIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/CosmosDbFactoryTestIT.java @@ -1,17 +1,17 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb; +package com.azure.spring.data.cosmos; -import com.microsoft.azure.spring.data.cosmosdb.config.CosmosDBConfig; -import com.microsoft.azure.spring.data.cosmosdb.exception.CosmosDBAccessException; -import com.microsoft.azure.spring.data.cosmosdb.repository.TestRepositoryConfig; +import com.azure.spring.data.cosmos.common.TestConstants; +import com.azure.spring.data.cosmos.config.CosmosDBConfig; +import com.azure.spring.data.cosmos.exception.CosmosDBAccessException; +import com.azure.spring.data.cosmos.repository.TestRepositoryConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Value; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.*; import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringJUnit4ClassRunner.class) @@ -26,14 +26,15 @@ public class CosmosDbFactoryTestIT { @Test(expected = IllegalArgumentException.class) public void testEmptyKey() { - final CosmosDBConfig dbConfig = CosmosDBConfig.builder(COSMOSDB_FAKE_HOST, "", DB_NAME).build(); + final CosmosDBConfig dbConfig = CosmosDBConfig.builder(TestConstants.COSMOSDB_FAKE_HOST, + "", TestConstants.DB_NAME).build(); new CosmosDbFactory(dbConfig); } @Test public void testInvalidEndpoint() { final CosmosDBConfig dbConfig = - CosmosDBConfig.builder(COSMOSDB_FAKE_HOST, COSMOSDB_FAKE_KEY, DB_NAME).build(); + CosmosDBConfig.builder(TestConstants.COSMOSDB_FAKE_HOST, TestConstants.COSMOSDB_FAKE_KEY, TestConstants.DB_NAME).build(); final CosmosDbFactory factory = new CosmosDbFactory(dbConfig); assertThat(factory).isNotNull(); @@ -42,7 +43,7 @@ public void testInvalidEndpoint() { @Test public void testConnectWithConnectionString() { final CosmosDBConfig dbConfig = - CosmosDBConfig.builder(COSMOSDB_FAKE_CONNECTION_STRING, DB_NAME).build(); + CosmosDBConfig.builder(TestConstants.COSMOSDB_FAKE_CONNECTION_STRING, TestConstants.DB_NAME).build(); final CosmosDbFactory factory = new CosmosDbFactory(dbConfig); assertThat(factory).isNotNull(); @@ -50,13 +51,13 @@ public void testConnectWithConnectionString() { @Test(expected = CosmosDBAccessException.class) public void testInvalidConnectionString() { - CosmosDBConfig.builder(COSMOSDB_INVALID_FAKE_CONNECTION_STRING, DB_NAME).build(); + CosmosDBConfig.builder(TestConstants.COSMOSDB_INVALID_FAKE_CONNECTION_STRING, TestConstants.DB_NAME).build(); } @Test public void testConnectionPolicyUserAgentKept() { final CosmosDBConfig dbConfig = - CosmosDBConfig.builder(cosmosDbUri, cosmosDbKey, DB_NAME).build(); + CosmosDBConfig.builder(cosmosDbUri, cosmosDbKey, TestConstants.DB_NAME).build(); final CosmosDbFactory factory = new CosmosDbFactory(dbConfig); factory.getCosmosClient(); diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/UserAgentTestIT.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/UserAgentTestIT.java similarity index 76% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/UserAgentTestIT.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/UserAgentTestIT.java index 3714460b8996..ba64a333b303 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/UserAgentTestIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/UserAgentTestIT.java @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb; +package com.azure.spring.data.cosmos; -import com.microsoft.azure.spring.data.cosmosdb.common.PropertyLoader; -import com.microsoft.azure.spring.data.cosmosdb.common.TestConstants; -import com.microsoft.azure.spring.data.cosmosdb.config.CosmosDBConfig; +import com.azure.spring.data.cosmos.common.PropertyLoader; +import com.azure.spring.data.cosmos.common.TestConstants; +import com.azure.spring.data.cosmos.config.CosmosDBConfig; +import org.assertj.core.api.Assertions; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; @@ -14,8 +15,6 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.springframework.context.annotation.PropertySource; -import static org.assertj.core.api.Assertions.assertThat; - @Ignore("Cannot use fake uri and key with CosmosDbFactory as it tries the connection on new creation." + "At the same time, cannot use mockito with real values, because it won't prepare PropertyLoader class for mocking") @RunWith(PowerMockRunner.class) @@ -33,7 +32,7 @@ public void testUserAgentSuffixAppended() { TestConstants.COSMOSDB_FAKE_KEY, TestConstants.DB_NAME).build(); final CosmosDbFactory factory = new CosmosDbFactory(dbConfig); factory.getCosmosClient(); - assertThat(factory.getConfig().getConnectionPolicy().userAgentSuffix()).contains(TEST_VERSION); + Assertions.assertThat(factory.getConfig().getConnectionPolicy().userAgentSuffix()).contains(TEST_VERSION); } } diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/common/DynamicContainer.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/common/DynamicContainer.java similarity index 85% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/common/DynamicContainer.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/common/DynamicContainer.java index 1f635b5f3a04..40eb9e50e07f 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/common/DynamicContainer.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/common/DynamicContainer.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.common; +package com.azure.spring.data.cosmos.common; public class DynamicContainer { private String containerName; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/common/ExpressionResolverUnitTest.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/common/ExpressionResolverUnitTest.java similarity index 96% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/common/ExpressionResolverUnitTest.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/common/ExpressionResolverUnitTest.java index ccb3160225ca..652657597662 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/common/ExpressionResolverUnitTest.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/common/ExpressionResolverUnitTest.java @@ -1,9 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.common; +package com.azure.spring.data.cosmos.common; import org.junit.Test; - import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/common/MemoizerUnitTest.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/common/MemoizerUnitTest.java similarity index 96% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/common/MemoizerUnitTest.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/common/MemoizerUnitTest.java index 0da9f66b63ff..e29aeed50175 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/common/MemoizerUnitTest.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/common/MemoizerUnitTest.java @@ -1,18 +1,18 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.common; +package com.azure.spring.data.cosmos.common; import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertEquals; - import java.util.HashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Function; import java.util.stream.IntStream; +import static org.junit.Assert.assertEquals; + /** * * @author Domenico Sibilio diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/common/PageTestUtils.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/common/PageTestUtils.java similarity index 91% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/common/PageTestUtils.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/common/PageTestUtils.java index 193369f5978e..77136280e095 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/common/PageTestUtils.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/common/PageTestUtils.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.common; +package com.azure.spring.data.cosmos.common; -import com.microsoft.azure.spring.data.cosmosdb.core.query.CosmosPageRequest; +import com.azure.spring.data.cosmos.core.query.CosmosPageRequest; import org.json.JSONObject; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/common/PropertyLoaderUnitTest.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/common/PropertyLoaderUnitTest.java similarity index 91% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/common/PropertyLoaderUnitTest.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/common/PropertyLoaderUnitTest.java index e66f6d6ece4e..0a9aa53f5163 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/common/PropertyLoaderUnitTest.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/common/PropertyLoaderUnitTest.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.common; +package com.azure.spring.data.cosmos.common; import org.junit.Assert; import org.junit.Test; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/common/ResponseDiagnosticsTestUtils.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/common/ResponseDiagnosticsTestUtils.java similarity index 85% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/common/ResponseDiagnosticsTestUtils.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/common/ResponseDiagnosticsTestUtils.java index 58049b859fb8..af5f731364b2 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/common/ResponseDiagnosticsTestUtils.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/common/ResponseDiagnosticsTestUtils.java @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.common; +package com.azure.spring.data.cosmos.common; import com.azure.data.cosmos.CosmosResponseDiagnostics; import com.azure.data.cosmos.FeedResponseDiagnostics; -import com.microsoft.azure.spring.data.cosmosdb.core.ResponseDiagnostics; -import com.microsoft.azure.spring.data.cosmosdb.core.ResponseDiagnosticsProcessor; +import com.azure.spring.data.cosmos.core.ResponseDiagnostics; +import com.azure.spring.data.cosmos.core.ResponseDiagnosticsProcessor; public class ResponseDiagnosticsTestUtils { diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/common/TestConstants.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/common/TestConstants.java similarity index 98% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/common/TestConstants.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/common/TestConstants.java index 5655cbba7a35..477e0a75fa64 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/common/TestConstants.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/common/TestConstants.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.common; +package com.azure.spring.data.cosmos.common; import com.azure.data.cosmos.IndexingMode; -import com.microsoft.azure.spring.data.cosmosdb.domain.Address; +import com.azure.spring.data.cosmos.domain.Address; import java.util.Arrays; import java.util.List; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/common/TestUtils.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/common/TestUtils.java similarity index 96% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/common/TestUtils.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/common/TestUtils.java index eadb92eeecd1..5f3572b7ddc0 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/common/TestUtils.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/common/TestUtils.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.common; +package com.azure.spring.data.cosmos.common; import org.springframework.util.Assert; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/config/AbstractCosmosConfigurationIT.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/config/AbstractCosmosConfigurationIT.java similarity index 94% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/config/AbstractCosmosConfigurationIT.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/config/AbstractCosmosConfigurationIT.java index a3fdd33fc4ef..734a73707973 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/config/AbstractCosmosConfigurationIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/config/AbstractCosmosConfigurationIT.java @@ -1,22 +1,21 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.config; +package com.azure.spring.data.cosmos.config; import com.azure.data.cosmos.ConsistencyLevel; import com.azure.data.cosmos.CosmosClient; import com.azure.data.cosmos.internal.RequestOptions; +import com.azure.spring.data.cosmos.Constants; +import com.azure.spring.data.cosmos.CosmosDbFactory; +import com.azure.spring.data.cosmos.common.ExpressionResolver; import com.fasterxml.jackson.databind.ObjectMapper; -import com.microsoft.azure.spring.data.cosmosdb.Constants; -import com.microsoft.azure.spring.data.cosmosdb.CosmosDbFactory; -import com.microsoft.azure.spring.data.cosmosdb.common.ExpressionResolver; -import com.microsoft.azure.spring.data.cosmosdb.common.TestConstants; +import com.azure.spring.data.cosmos.common.TestConstants; import org.assertj.core.api.Assertions; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.mockito.Mock; - import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.AnnotationConfigApplicationContext; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/CosmosTemplateIT.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/CosmosTemplateIT.java similarity index 87% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/CosmosTemplateIT.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/CosmosTemplateIT.java index 289a2e4d33ea..c445b25be9ce 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/CosmosTemplateIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/CosmosTemplateIT.java @@ -1,22 +1,23 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core; +package com.azure.spring.data.cosmos.core; import com.azure.data.cosmos.CosmosClientException; import com.azure.data.cosmos.PartitionKey; -import com.microsoft.azure.spring.data.cosmosdb.CosmosDbFactory; -import com.microsoft.azure.spring.data.cosmosdb.common.ResponseDiagnosticsTestUtils; -import com.microsoft.azure.spring.data.cosmosdb.config.CosmosDBConfig; -import com.microsoft.azure.spring.data.cosmosdb.core.convert.MappingCosmosConverter; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.CosmosMappingContext; -import com.microsoft.azure.spring.data.cosmosdb.core.query.CosmosPageRequest; -import com.microsoft.azure.spring.data.cosmosdb.core.query.Criteria; -import com.microsoft.azure.spring.data.cosmosdb.core.query.CriteriaType; -import com.microsoft.azure.spring.data.cosmosdb.core.query.DocumentQuery; -import com.microsoft.azure.spring.data.cosmosdb.domain.Person; -import com.microsoft.azure.spring.data.cosmosdb.exception.CosmosDBAccessException; -import com.microsoft.azure.spring.data.cosmosdb.repository.TestRepositoryConfig; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.CosmosDbFactory; +import com.azure.spring.data.cosmos.common.PageTestUtils; +import com.azure.spring.data.cosmos.common.ResponseDiagnosticsTestUtils; +import com.azure.spring.data.cosmos.config.CosmosDBConfig; +import com.azure.spring.data.cosmos.core.convert.MappingCosmosConverter; +import com.azure.spring.data.cosmos.core.mapping.CosmosMappingContext; +import com.azure.spring.data.cosmos.core.query.CosmosPageRequest; +import com.azure.spring.data.cosmos.core.query.Criteria; +import com.azure.spring.data.cosmos.core.query.CriteriaType; +import com.azure.spring.data.cosmos.core.query.DocumentQuery; +import com.azure.spring.data.cosmos.domain.Person; +import com.azure.spring.data.cosmos.exception.CosmosDBAccessException; +import com.azure.spring.data.cosmos.repository.TestRepositoryConfig; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; import org.assertj.core.util.Lists; import org.junit.After; import org.junit.AfterClass; @@ -37,22 +38,7 @@ import java.util.List; import java.util.UUID; -import static com.microsoft.azure.spring.data.cosmosdb.common.PageTestUtils.validateLastPage; -import static com.microsoft.azure.spring.data.cosmosdb.common.PageTestUtils.validateNonLastPage; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.ADDRESSES; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.FIRST_NAME; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.HOBBIES; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.ID_1; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.ID_2; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.ID_3; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.LAST_NAME; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.NEW_FIRST_NAME; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.NEW_LAST_NAME; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.NOT_EXIST_ID; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.PAGE_SIZE_1; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.PAGE_SIZE_2; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.PAGE_SIZE_3; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.UPDATED_FIRST_NAME; +import static com.azure.spring.data.cosmos.common.TestConstants.*; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; @@ -325,7 +311,7 @@ public void testFindAllPageableMultiPages() { final Page page1 = cosmosTemplate.findAll(pageRequest, Person.class, containerName); assertThat(page1.getContent().size()).isEqualTo(PAGE_SIZE_1); - validateNonLastPage(page1, PAGE_SIZE_1); + PageTestUtils.validateNonLastPage(page1, PAGE_SIZE_1); assertThat(responseDiagnosticsTestUtils.getCosmosResponseDiagnostics()).isNull(); assertThat(responseDiagnosticsTestUtils.getFeedResponseDiagnostics()).isNotNull(); @@ -335,7 +321,7 @@ public void testFindAllPageableMultiPages() { final Page page2 = cosmosTemplate.findAll(page1.getPageable(), Person.class, containerName); assertThat(page2.getContent().size()).isEqualTo(1); - validateLastPage(page2, PAGE_SIZE_1); + PageTestUtils.validateLastPage(page2, PAGE_SIZE_1); assertThat(responseDiagnosticsTestUtils.getCosmosResponseDiagnostics()).isNull(); assertThat(responseDiagnosticsTestUtils.getFeedResponseDiagnostics()).isNotNull(); @@ -359,7 +345,7 @@ public void testPaginationQuery() { final Page page = cosmosTemplate.paginationQuery(query, Person.class, containerName); assertThat(page.getContent().size()).isEqualTo(1); - validateLastPage(page, page.getContent().size()); + PageTestUtils.validateLastPage(page, page.getContent().size()); assertThat(responseDiagnosticsTestUtils.getCosmosResponseDiagnostics()).isNull(); assertThat(responseDiagnosticsTestUtils.getFeedResponseDiagnostics()).isNotNull(); @@ -383,7 +369,7 @@ public void testFindAllWithPageableAndSort() { final Page page = cosmosTemplate.findAll(pageRequest, Person.class, containerName); assertThat(page.getContent().size()).isEqualTo(3); - validateLastPage(page, PAGE_SIZE_3); + PageTestUtils.validateLastPage(page, PAGE_SIZE_3); final List result = page.getContent(); assertThat(result.get(0).getFirstName()).isEqualTo(NEW_FIRST_NAME); @@ -418,7 +404,7 @@ public void testFindAllWithTwoPagesAndVerifySortOrder() { containerName); assertThat(firstPage.getContent().size()).isEqualTo(3); - validateNonLastPage(firstPage, firstPage.getContent().size()); + PageTestUtils.validateNonLastPage(firstPage, firstPage.getContent().size()); final List firstPageResults = firstPage.getContent(); assertThat(firstPageResults.get(0).getFirstName()).isEqualTo(testPerson4.getFirstName()); @@ -429,7 +415,7 @@ public void testFindAllWithTwoPagesAndVerifySortOrder() { containerName); assertThat(secondPage.getContent().size()).isEqualTo(2); - validateLastPage(secondPage, secondPage.getContent().size()); + PageTestUtils.validateLastPage(secondPage, secondPage.getContent().size()); final List secondPageResults = secondPage.getContent(); assertThat(secondPageResults.get(0).getFirstName()).isEqualTo(NEW_FIRST_NAME); diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/CosmosTemplateIllegalTest.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/CosmosTemplateIllegalTest.java similarity index 90% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/CosmosTemplateIllegalTest.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/CosmosTemplateIllegalTest.java index 0c63ef1c49e9..b569f8d21159 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/CosmosTemplateIllegalTest.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/CosmosTemplateIllegalTest.java @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core; +package com.azure.spring.data.cosmos.core; import com.azure.data.cosmos.PartitionKey; -import com.microsoft.azure.spring.data.cosmosdb.core.query.Criteria; -import com.microsoft.azure.spring.data.cosmosdb.core.query.DocumentQuery; -import com.microsoft.azure.spring.data.cosmosdb.domain.Person; +import com.azure.spring.data.cosmos.core.query.Criteria; +import com.azure.spring.data.cosmos.core.query.CriteriaType; +import com.azure.spring.data.cosmos.core.query.DocumentQuery; +import com.azure.spring.data.cosmos.domain.Person; import org.apache.commons.lang3.StringUtils; import org.junit.Before; import org.junit.Test; @@ -15,8 +16,6 @@ import org.mockito.junit.MockitoJUnitRunner; import org.springframework.util.Assert; -import static com.microsoft.azure.spring.data.cosmosdb.core.query.CriteriaType.IS_EQUAL; - import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Arrays; @@ -44,7 +43,7 @@ public void setUp() { @Test public void deleteIllegalShouldFail() throws NoSuchMethodException { final Method method = dbTemplateClass.getMethod("delete", DocumentQuery.class, Class.class, String.class); - final Criteria criteria = Criteria.getInstance(IS_EQUAL, "faker", Arrays.asList("faker-value")); + final Criteria criteria = Criteria.getInstance(CriteriaType.IS_EQUAL, "faker", Arrays.asList("faker-value")); final DocumentQuery query = new DocumentQuery(criteria); checkIllegalArgument(method, null, Person.class, DUMMY_COLL); diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/CosmosTemplatePartitionIT.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/CosmosTemplatePartitionIT.java similarity index 84% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/CosmosTemplatePartitionIT.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/CosmosTemplatePartitionIT.java index 2094ff7058c0..b72787b917ca 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/CosmosTemplatePartitionIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/CosmosTemplatePartitionIT.java @@ -1,20 +1,21 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core; +package com.azure.spring.data.cosmos.core; import com.azure.data.cosmos.PartitionKey; -import com.microsoft.azure.spring.data.cosmosdb.CosmosDbFactory; -import com.microsoft.azure.spring.data.cosmosdb.config.CosmosDBConfig; -import com.microsoft.azure.spring.data.cosmosdb.core.convert.MappingCosmosConverter; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.CosmosMappingContext; -import com.microsoft.azure.spring.data.cosmosdb.core.query.CosmosPageRequest; -import com.microsoft.azure.spring.data.cosmosdb.core.query.Criteria; -import com.microsoft.azure.spring.data.cosmosdb.core.query.CriteriaType; -import com.microsoft.azure.spring.data.cosmosdb.core.query.DocumentQuery; -import com.microsoft.azure.spring.data.cosmosdb.domain.PartitionPerson; -import com.microsoft.azure.spring.data.cosmosdb.repository.TestRepositoryConfig; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.CosmosDbFactory; +import com.azure.spring.data.cosmos.common.PageTestUtils; +import com.azure.spring.data.cosmos.config.CosmosDBConfig; +import com.azure.spring.data.cosmos.core.convert.MappingCosmosConverter; +import com.azure.spring.data.cosmos.core.mapping.CosmosMappingContext; +import com.azure.spring.data.cosmos.core.query.CosmosPageRequest; +import com.azure.spring.data.cosmos.core.query.Criteria; +import com.azure.spring.data.cosmos.core.query.CriteriaType; +import com.azure.spring.data.cosmos.core.query.DocumentQuery; +import com.azure.spring.data.cosmos.domain.PartitionPerson; +import com.azure.spring.data.cosmos.repository.TestRepositoryConfig; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; @@ -33,10 +34,7 @@ import java.util.List; import java.util.UUID; -import static com.microsoft.azure.spring.data.cosmosdb.common.PageTestUtils.validateLastPage; -import static com.microsoft.azure.spring.data.cosmosdb.common.PageTestUtils.validateNonLastPage; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.*; -import static com.microsoft.azure.spring.data.cosmosdb.core.query.CriteriaType.IS_EQUAL; +import static com.azure.spring.data.cosmos.common.TestConstants.*; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; @@ -93,7 +91,7 @@ public static void afterClassCleanup() { @Test public void testFindWithPartition() { - Criteria criteria = Criteria.getInstance(IS_EQUAL, PROPERTY_LAST_NAME, Arrays.asList(LAST_NAME)); + Criteria criteria = Criteria.getInstance(CriteriaType.IS_EQUAL, PROPERTY_LAST_NAME, Arrays.asList(LAST_NAME)); DocumentQuery query = new DocumentQuery(criteria); List result = cosmosTemplate.find(query, PartitionPerson.class, PartitionPerson.class.getSimpleName()); @@ -101,7 +99,7 @@ public void testFindWithPartition() { assertThat(result.size()).isEqualTo(1); assertEquals(TEST_PERSON, result.get(0)); - criteria = Criteria.getInstance(IS_EQUAL, PROPERTY_ID, Arrays.asList(ID_1)); + criteria = Criteria.getInstance(CriteriaType.IS_EQUAL, PROPERTY_ID, Arrays.asList(ID_1)); query = new DocumentQuery(criteria); result = cosmosTemplate.find(query, PartitionPerson.class, PartitionPerson.class.getSimpleName()); @@ -121,7 +119,7 @@ public void testFindByIdWithPartition() { @Test public void testFindByNonExistIdWithPartition() { - final Criteria criteria = Criteria.getInstance(IS_EQUAL, PROPERTY_ID, Arrays.asList(NOT_EXIST_ID)); + final Criteria criteria = Criteria.getInstance(CriteriaType.IS_EQUAL, PROPERTY_ID, Arrays.asList(NOT_EXIST_ID)); final DocumentQuery query = new DocumentQuery(criteria); final List result = cosmosTemplate.find(query, PartitionPerson.class, @@ -218,12 +216,12 @@ public void testPartitionedFindAllPageableMultiPages() { final Page page1 = cosmosTemplate.findAll(pageRequest, PartitionPerson.class, containerName); assertThat(page1.getContent().size()).isEqualTo(PAGE_SIZE_1); - validateNonLastPage(page1, PAGE_SIZE_1); + PageTestUtils.validateNonLastPage(page1, PAGE_SIZE_1); final Page page2 = cosmosTemplate.findAll(page1.getPageable(), PartitionPerson.class, containerName); assertThat(page2.getContent().size()).isEqualTo(1); - validateLastPage(page2, PAGE_SIZE_1); + PageTestUtils.validateLastPage(page2, PAGE_SIZE_1); } @Test @@ -237,6 +235,6 @@ public void testPartitionedPaginationQuery() { final Page page = cosmosTemplate.paginationQuery(query, PartitionPerson.class, containerName); assertThat(page.getContent().size()).isEqualTo(1); - validateLastPage(page, page.getContent().size()); + PageTestUtils.validateLastPage(page, page.getContent().size()); } } diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/CosmosTemplateUnitTest.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/CosmosTemplateUnitTest.java similarity index 70% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/CosmosTemplateUnitTest.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/CosmosTemplateUnitTest.java index 09e796d184ec..f183b45b3764 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/CosmosTemplateUnitTest.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/CosmosTemplateUnitTest.java @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core; +package com.azure.spring.data.cosmos.core; -import com.microsoft.azure.spring.data.cosmosdb.CosmosDbFactory; -import com.microsoft.azure.spring.data.cosmosdb.common.TestConstants; -import com.microsoft.azure.spring.data.cosmosdb.config.CosmosDBConfig; +import com.azure.spring.data.cosmos.CosmosDbFactory; +import com.azure.spring.data.cosmos.common.TestConstants; +import com.azure.spring.data.cosmos.config.CosmosDBConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/ReactiveCosmosTemplateIT.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/ReactiveCosmosTemplateIT.java similarity index 80% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/ReactiveCosmosTemplateIT.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/ReactiveCosmosTemplateIT.java index 37395f876c36..46c056d6ac94 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/ReactiveCosmosTemplateIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/ReactiveCosmosTemplateIT.java @@ -1,29 +1,26 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core; +package com.azure.spring.data.cosmos.core; import com.azure.data.cosmos.CosmosClientException; import com.azure.data.cosmos.CosmosKeyCredential; import com.azure.data.cosmos.PartitionKey; -import com.microsoft.azure.spring.data.cosmosdb.CosmosDbFactory; -import com.microsoft.azure.spring.data.cosmosdb.common.ResponseDiagnosticsTestUtils; -import com.microsoft.azure.spring.data.cosmosdb.common.TestConstants; -import com.microsoft.azure.spring.data.cosmosdb.config.CosmosDBConfig; -import com.microsoft.azure.spring.data.cosmosdb.core.convert.MappingCosmosConverter; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.CosmosMappingContext; -import com.microsoft.azure.spring.data.cosmosdb.core.query.Criteria; -import com.microsoft.azure.spring.data.cosmosdb.core.query.CriteriaType; -import com.microsoft.azure.spring.data.cosmosdb.core.query.DocumentQuery; -import com.microsoft.azure.spring.data.cosmosdb.domain.Person; -import com.microsoft.azure.spring.data.cosmosdb.exception.CosmosDBAccessException; -import com.microsoft.azure.spring.data.cosmosdb.repository.TestRepositoryConfig; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.CosmosDbFactory; +import com.azure.spring.data.cosmos.common.ResponseDiagnosticsTestUtils; +import com.azure.spring.data.cosmos.common.TestConstants; +import com.azure.spring.data.cosmos.config.CosmosDBConfig; +import com.azure.spring.data.cosmos.core.convert.MappingCosmosConverter; +import com.azure.spring.data.cosmos.core.mapping.CosmosMappingContext; +import com.azure.spring.data.cosmos.core.query.Criteria; +import com.azure.spring.data.cosmos.core.query.CriteriaType; +import com.azure.spring.data.cosmos.core.query.DocumentQuery; +import com.azure.spring.data.cosmos.domain.Person; +import com.azure.spring.data.cosmos.exception.CosmosDBAccessException; +import com.azure.spring.data.cosmos.repository.TestRepositoryConfig; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; import io.reactivex.subscribers.TestSubscriber; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.assertj.core.api.Assertions; +import org.junit.*; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -40,7 +37,6 @@ import java.util.Arrays; import java.util.List; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.UPDATED_FIRST_NAME; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; @@ -147,8 +143,8 @@ public void testFindByID() { .consumeNextWith(actual -> Assert.assertEquals(actual, TEST_PERSON)) .verifyComplete(); assertThat(responseDiagnosticsTestUtils.getFeedResponseDiagnostics()).isNotNull(); - assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNotNull(); - assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics().getRequestCharge()).isGreaterThan(0); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNotNull(); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics().getRequestCharge()).isGreaterThan(0); } @Test @@ -163,8 +159,8 @@ public void testFindByIDBySecondaryKey() { }).verifyComplete(); assertThat(responseDiagnosticsTestUtils.getFeedResponseDiagnostics()).isNotNull(); - assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNotNull(); - assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics().getRequestCharge()).isGreaterThan(0); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNotNull(); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics().getRequestCharge()).isGreaterThan(0); } @Test @@ -174,8 +170,8 @@ public void testFindAll() { StepVerifier.create(flux).expectNextCount(1).verifyComplete(); assertThat(responseDiagnosticsTestUtils.getFeedResponseDiagnostics()).isNotNull(); - assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNotNull(); - assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics().getRequestCharge()).isGreaterThan(0); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNotNull(); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics().getRequestCharge()).isGreaterThan(0); } @Test @@ -186,8 +182,8 @@ public void testFindByIdWithContainerName() { .verifyComplete(); assertThat(responseDiagnosticsTestUtils.getFeedResponseDiagnostics()).isNotNull(); - assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNotNull(); - assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics().getRequestCharge()).isGreaterThan(0); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNotNull(); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics().getRequestCharge()).isGreaterThan(0); } @Test @@ -197,7 +193,7 @@ public void testInsert() { .expectNext(TEST_PERSON_3).verifyComplete(); assertThat(responseDiagnosticsTestUtils.getFeedResponseDiagnostics()).isNull(); - assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNull(); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNull(); assertThat(responseDiagnosticsTestUtils.getCosmosResponseDiagnostics()).isNotNull(); } @@ -209,7 +205,7 @@ public void testInsertBySecondaryKey() { .expectNext(TEST_PERSON_3).verifyComplete(); assertThat(responseDiagnosticsTestUtils.getFeedResponseDiagnostics()).isNull(); - assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNull(); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNull(); assertThat(responseDiagnosticsTestUtils.getCosmosResponseDiagnostics()).isNotNull(); } @@ -220,7 +216,7 @@ public void testInsertWithContainerName() { .expectNext(TEST_PERSON_2).verifyComplete(); assertThat(responseDiagnosticsTestUtils.getFeedResponseDiagnostics()).isNull(); - assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNull(); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNull(); assertThat(responseDiagnosticsTestUtils.getCosmosResponseDiagnostics()).isNotNull(); } @@ -236,13 +232,13 @@ public void testUpsert() { StepVerifier.create(upsert).expectNextCount(1).verifyComplete(); assertThat(responseDiagnosticsTestUtils.getFeedResponseDiagnostics()).isNull(); - assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNull(); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNull(); assertThat(responseDiagnosticsTestUtils.getCosmosResponseDiagnostics()).isNotNull(); } @Test public void testOptimisticLockWhenUpdatingWithWrongEtag() { - final Person updated = new Person(TEST_PERSON.getId(), UPDATED_FIRST_NAME, + final Person updated = new Person(TEST_PERSON.getId(), TestConstants.UPDATED_FIRST_NAME, TEST_PERSON.getLastName(), TEST_PERSON.getHobbies(), TEST_PERSON.getShippingAddresses()); updated.set_etag(WRONG_ETAG); @@ -275,7 +271,7 @@ public void testUpsertBySecondaryKey() { StepVerifier.create(upsert).expectNextCount(1).verifyComplete(); assertThat(responseDiagnosticsTestUtils.getFeedResponseDiagnostics()).isNull(); - assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNull(); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNull(); assertThat(responseDiagnosticsTestUtils.getCosmosResponseDiagnostics()).isNotNull(); } @@ -290,7 +286,7 @@ public void testUpsertWithContainerName() { StepVerifier.create(upsert).expectNextCount(1).verifyComplete(); assertThat(responseDiagnosticsTestUtils.getFeedResponseDiagnostics()).isNull(); - assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNull(); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNull(); assertThat(responseDiagnosticsTestUtils.getCosmosResponseDiagnostics()).isNotNull(); } @@ -300,15 +296,15 @@ public void testDeleteById() { new PartitionKey(personInfo.getPartitionKeyFieldValue(TEST_PERSON_4))).block(); assertThat(responseDiagnosticsTestUtils.getFeedResponseDiagnostics()).isNull(); - assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNull(); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNull(); assertThat(responseDiagnosticsTestUtils.getCosmosResponseDiagnostics()).isNotNull(); Flux flux = cosmosTemplate.findAll(Person.class.getSimpleName(), Person.class); StepVerifier.create(flux).expectNextCount(2).verifyComplete(); assertThat(responseDiagnosticsTestUtils.getFeedResponseDiagnostics()).isNotNull(); - assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNotNull(); - assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics().getRequestCharge()).isGreaterThan(0); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNotNull(); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics().getRequestCharge()).isGreaterThan(0); assertThat(responseDiagnosticsTestUtils.getCosmosResponseDiagnostics()).isNull(); final Mono voidMono = cosmosTemplate.deleteById(Person.class.getSimpleName(), @@ -317,15 +313,15 @@ public void testDeleteById() { StepVerifier.create(voidMono).verifyComplete(); assertThat(responseDiagnosticsTestUtils.getFeedResponseDiagnostics()).isNull(); - assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNull(); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNull(); assertThat(responseDiagnosticsTestUtils.getCosmosResponseDiagnostics()).isNotNull(); flux = cosmosTemplate.findAll(Person.class.getSimpleName(), Person.class); StepVerifier.create(flux).expectNextCount(1).verifyComplete(); assertThat(responseDiagnosticsTestUtils.getFeedResponseDiagnostics()).isNotNull(); - assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNotNull(); - assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics().getRequestCharge()).isGreaterThan(0); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNotNull(); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics().getRequestCharge()).isGreaterThan(0); assertThat(responseDiagnosticsTestUtils.getCosmosResponseDiagnostics()).isNull(); } @@ -354,8 +350,8 @@ public void testFind() { StepVerifier.create(personFlux).expectNextCount(1).verifyComplete(); assertThat(responseDiagnosticsTestUtils.getFeedResponseDiagnostics()).isNotNull(); - assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNotNull(); - assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics().getRequestCharge()).isGreaterThan(0); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNotNull(); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics().getRequestCharge()).isGreaterThan(0); assertThat(responseDiagnosticsTestUtils.getCosmosResponseDiagnostics()).isNull(); } @@ -368,8 +364,8 @@ public void testExists() { StepVerifier.create(exists).expectNext(true).verifyComplete(); assertThat(responseDiagnosticsTestUtils.getFeedResponseDiagnostics()).isNotNull(); - assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNotNull(); - assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics().getRequestCharge()).isGreaterThan(0); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNotNull(); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics().getRequestCharge()).isGreaterThan(0); assertThat(responseDiagnosticsTestUtils.getCosmosResponseDiagnostics()).isNull(); } @@ -379,8 +375,8 @@ public void testCount() { StepVerifier.create(count).expectNext((long) 1).verifyComplete(); assertThat(responseDiagnosticsTestUtils.getFeedResponseDiagnostics()).isNotNull(); - assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNotNull(); - assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics().getRequestCharge()).isGreaterThan(0); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNotNull(); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics().getRequestCharge()).isGreaterThan(0); assertThat(responseDiagnosticsTestUtils.getCosmosResponseDiagnostics()).isNull(); } diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/ReactiveCosmosTemplatePartitionIT.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/ReactiveCosmosTemplatePartitionIT.java similarity index 75% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/ReactiveCosmosTemplatePartitionIT.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/ReactiveCosmosTemplatePartitionIT.java index fce527da71b0..934b6bb546fd 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/ReactiveCosmosTemplatePartitionIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/ReactiveCosmosTemplatePartitionIT.java @@ -1,22 +1,20 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core; +package com.azure.spring.data.cosmos.core; import com.azure.data.cosmos.PartitionKey; -import com.microsoft.azure.spring.data.cosmosdb.CosmosDbFactory; -import com.microsoft.azure.spring.data.cosmosdb.config.CosmosDBConfig; -import com.microsoft.azure.spring.data.cosmosdb.core.convert.MappingCosmosConverter; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.CosmosMappingContext; -import com.microsoft.azure.spring.data.cosmosdb.core.query.Criteria; -import com.microsoft.azure.spring.data.cosmosdb.core.query.DocumentQuery; -import com.microsoft.azure.spring.data.cosmosdb.domain.PartitionPerson; -import com.microsoft.azure.spring.data.cosmosdb.repository.TestRepositoryConfig; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import com.azure.spring.data.cosmos.CosmosDbFactory; +import com.azure.spring.data.cosmos.common.TestConstants; +import com.azure.spring.data.cosmos.config.CosmosDBConfig; +import com.azure.spring.data.cosmos.core.convert.MappingCosmosConverter; +import com.azure.spring.data.cosmos.core.mapping.CosmosMappingContext; +import com.azure.spring.data.cosmos.core.query.Criteria; +import com.azure.spring.data.cosmos.core.query.CriteriaType; +import com.azure.spring.data.cosmos.core.query.DocumentQuery; +import com.azure.spring.data.cosmos.domain.PartitionPerson; +import com.azure.spring.data.cosmos.repository.TestRepositoryConfig; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; +import org.junit.*; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.domain.EntityScanner; @@ -31,17 +29,6 @@ import java.util.Arrays; import java.util.UUID; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.ADDRESSES; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.FIRST_NAME; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.HOBBIES; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.ID_1; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.ID_2; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.LAST_NAME; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.NEW_FIRST_NAME; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.NEW_LAST_NAME; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.PROPERTY_LAST_NAME; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.UPDATED_FIRST_NAME; -import static com.microsoft.azure.spring.data.cosmosdb.core.query.CriteriaType.IS_EQUAL; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertTrue; @@ -49,11 +36,11 @@ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = TestRepositoryConfig.class) public class ReactiveCosmosTemplatePartitionIT { - private static final PartitionPerson TEST_PERSON = new PartitionPerson(ID_1, FIRST_NAME, LAST_NAME, - HOBBIES, ADDRESSES); + private static final PartitionPerson TEST_PERSON = new PartitionPerson(TestConstants.ID_1, TestConstants.FIRST_NAME, TestConstants.LAST_NAME, + TestConstants.HOBBIES, TestConstants.ADDRESSES); - private static final PartitionPerson TEST_PERSON_2 = new PartitionPerson(ID_2, NEW_FIRST_NAME, - TEST_PERSON.getLastName(), HOBBIES, ADDRESSES); + private static final PartitionPerson TEST_PERSON_2 = new PartitionPerson(TestConstants.ID_2, TestConstants.NEW_FIRST_NAME, + TEST_PERSON.getLastName(), TestConstants.HOBBIES, TestConstants.ADDRESSES); private static ReactiveCosmosTemplate cosmosTemplate; private static String containerName; @@ -101,8 +88,8 @@ public static void afterClassCleanup() { @Test public void testFindWithPartition() { - final Criteria criteria = Criteria.getInstance(IS_EQUAL, PROPERTY_LAST_NAME, - Arrays.asList(LAST_NAME)); + final Criteria criteria = Criteria.getInstance(CriteriaType.IS_EQUAL, TestConstants.PROPERTY_LAST_NAME, + Arrays.asList(TestConstants.LAST_NAME)); final DocumentQuery query = new DocumentQuery(criteria); final Flux partitionPersonFlux = cosmosTemplate.find(query, PartitionPerson.class, @@ -132,9 +119,9 @@ public void testFindByIdWithPartition() { @Test public void testUpsertNewDocumentPartition() { - final String firstName = NEW_FIRST_NAME + "_" + UUID.randomUUID().toString(); + final String firstName = TestConstants.NEW_FIRST_NAME + "_" + UUID.randomUUID().toString(); final PartitionPerson newPerson = new PartitionPerson(UUID.randomUUID().toString(), - firstName, NEW_LAST_NAME, + firstName, TestConstants.NEW_LAST_NAME, null, null); final String partitionKeyValue = newPerson.getLastName(); final Mono upsert = cosmosTemplate.upsert(newPerson, @@ -144,7 +131,7 @@ public void testUpsertNewDocumentPartition() { @Test public void testUpdateWithPartition() { - final PartitionPerson updated = new PartitionPerson(TEST_PERSON.getId(), UPDATED_FIRST_NAME, + final PartitionPerson updated = new PartitionPerson(TEST_PERSON.getId(), TestConstants.UPDATED_FIRST_NAME, TEST_PERSON.getLastName(), TEST_PERSON.getHobbies(), TEST_PERSON.getShippingAddresses()); cosmosTemplate.upsert(updated, new PartitionKey(updated.getLastName())).block(); @@ -193,7 +180,7 @@ public void testCountForPartitionedCollection() { @Test public void testCountForPartitionedCollectionByQuery() { cosmosTemplate.insert(TEST_PERSON_2, new PartitionKey(TEST_PERSON_2.getLastName())).block(); - final Criteria criteria = Criteria.getInstance(IS_EQUAL, "firstName", + final Criteria criteria = Criteria.getInstance(CriteriaType.IS_EQUAL, "firstName", Arrays.asList(TEST_PERSON_2.getFirstName())); final DocumentQuery query = new DocumentQuery(criteria); StepVerifier.create(cosmosTemplate.count(query, containerName)) diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/convert/ZonedDateTimeDeserializerTest.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/convert/ZonedDateTimeDeserializerTest.java similarity index 90% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/convert/ZonedDateTimeDeserializerTest.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/convert/ZonedDateTimeDeserializerTest.java index dc7622c948a4..64e3478866ba 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/convert/ZonedDateTimeDeserializerTest.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/convert/ZonedDateTimeDeserializerTest.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core.convert; +package com.azure.spring.data.cosmos.core.convert; import org.junit.Test; @@ -24,7 +24,7 @@ public class ZonedDateTimeDeserializerTest { @Test public void deserializeZonedDateTime() throws IOException { final ZonedDateTimeWrapper wrapper = ObjectMapperFactory.getObjectMapper() - .readValue(ZONED_DATE_TIME_WRAPPER_JSON, ZonedDateTimeWrapper.class); + .readValue(ZONED_DATE_TIME_WRAPPER_JSON, ZonedDateTimeWrapper.class); assertThat(wrapper.getZonedDateTime()).isEqualTo(ZONED_DATE_TIME); } diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/converter/MappingCosmosConverterUnitTest.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/converter/MappingCosmosConverterUnitTest.java similarity index 90% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/converter/MappingCosmosConverterUnitTest.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/converter/MappingCosmosConverterUnitTest.java index c0d3c93947ae..b690633be817 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/converter/MappingCosmosConverterUnitTest.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/converter/MappingCosmosConverterUnitTest.java @@ -1,15 +1,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core.converter; +package com.azure.spring.data.cosmos.core.converter; import com.azure.data.cosmos.CosmosItemProperties; +import com.azure.spring.data.cosmos.core.convert.MappingCosmosConverter; +import com.azure.spring.data.cosmos.core.mapping.CosmosMappingContext; import com.fasterxml.jackson.databind.ObjectMapper; -import com.microsoft.azure.spring.data.cosmosdb.common.TestConstants; -import com.microsoft.azure.spring.data.cosmosdb.core.convert.MappingCosmosConverter; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.CosmosMappingContext; -import com.microsoft.azure.spring.data.cosmosdb.domain.Address; -import com.microsoft.azure.spring.data.cosmosdb.domain.Memo; -import com.microsoft.azure.spring.data.cosmosdb.domain.Importance; +import com.azure.spring.data.cosmos.common.TestConstants; +import com.azure.spring.data.cosmos.domain.Address; +import com.azure.spring.data.cosmos.domain.Importance; +import com.azure.spring.data.cosmos.domain.Memo; import org.json.JSONObject; import org.junit.Before; import org.junit.Test; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/BasicCosmosPersistentEntityUnitTest.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/mapping/BasicCosmosPersistentEntityUnitTest.java similarity index 86% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/BasicCosmosPersistentEntityUnitTest.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/mapping/BasicCosmosPersistentEntityUnitTest.java index 8c5282ff1a1f..aadb113e5acd 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/BasicCosmosPersistentEntityUnitTest.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/mapping/BasicCosmosPersistentEntityUnitTest.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core.mapping; +package com.azure.spring.data.cosmos.core.mapping; -import com.microsoft.azure.spring.data.cosmosdb.domain.Person; +import com.azure.spring.data.cosmos.domain.Person; import org.junit.Test; import org.springframework.data.util.ClassTypeInformation; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/CosmosMappingContextUnitTest.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/mapping/CosmosMappingContextUnitTest.java similarity index 91% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/CosmosMappingContextUnitTest.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/mapping/CosmosMappingContextUnitTest.java index db6fd8cbed87..2ed4fbbdc906 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/mapping/CosmosMappingContextUnitTest.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/mapping/CosmosMappingContextUnitTest.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core.mapping; +package com.azure.spring.data.cosmos.core.mapping; import org.junit.Test; import org.mockito.Mock; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/query/CriteriaUnitTest.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/query/CriteriaUnitTest.java similarity index 86% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/query/CriteriaUnitTest.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/query/CriteriaUnitTest.java index 7a56dc01436b..1128cefbf5a5 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/query/CriteriaUnitTest.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/query/CriteriaUnitTest.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core.query; +package com.azure.spring.data.cosmos.core.query; -import com.microsoft.azure.spring.data.cosmosdb.core.generator.FindQuerySpecGenerator; -import com.microsoft.azure.spring.data.cosmosdb.exception.IllegalQueryException; +import com.azure.spring.data.cosmos.core.generator.FindQuerySpecGenerator; +import com.azure.spring.data.cosmos.exception.IllegalQueryException; import org.junit.Assert; import org.junit.Test; @@ -11,8 +11,8 @@ import java.util.Collections; import java.util.List; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.CRITERIA_KEY; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.CRITERIA_OBJECT; +import static com.azure.spring.data.cosmos.common.TestConstants.CRITERIA_KEY; +import static com.azure.spring.data.cosmos.common.TestConstants.CRITERIA_OBJECT; public class CriteriaUnitTest { diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/query/DocumentQueryUnitTest.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/query/DocumentQueryUnitTest.java similarity index 75% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/query/DocumentQueryUnitTest.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/query/DocumentQueryUnitTest.java index 0f65f3635d0f..06cdf4370ac6 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/core/query/DocumentQueryUnitTest.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/query/DocumentQueryUnitTest.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.core.query; +package com.azure.spring.data.cosmos.core.query; import org.junit.Assert; import org.junit.Test; @@ -9,8 +9,8 @@ import java.util.Arrays; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.CRITERIA_KEY; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.CRITERIA_OBJECT; +import static com.azure.spring.data.cosmos.common.TestConstants.CRITERIA_KEY; +import static com.azure.spring.data.cosmos.common.TestConstants.CRITERIA_OBJECT; public class DocumentQueryUnitTest { diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Address.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Address.java similarity index 89% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Address.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Address.java index 3539bc569a90..531fa409e6ef 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Address.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Address.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.domain; +package com.azure.spring.data.cosmos.domain; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.Document; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.PartitionKey; +import com.azure.spring.data.cosmos.core.mapping.Document; +import com.azure.spring.data.cosmos.core.mapping.PartitionKey; import org.springframework.data.annotation.Id; import java.util.Objects; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Contact.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Contact.java similarity index 91% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Contact.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Contact.java index 3c2bfc9c5dd4..782bf07b20b9 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Contact.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Contact.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.domain; +package com.azure.spring.data.cosmos.domain; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.Document; +import com.azure.spring.data.cosmos.core.mapping.Document; import org.springframework.data.annotation.Id; import java.util.Objects; @@ -14,6 +14,9 @@ public class Contact { private String title; + public Contact() { + } + public Contact(String logicId, String title) { this.logicId = logicId; this.title = title; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Course.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Course.java similarity index 89% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Course.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Course.java index 872e92b2dd0f..fa75b73a3934 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Course.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Course.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.domain; +package com.azure.spring.data.cosmos.domain; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.Document; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.PartitionKey; +import com.azure.spring.data.cosmos.core.mapping.Document; +import com.azure.spring.data.cosmos.core.mapping.PartitionKey; import org.springframework.data.annotation.Id; import java.util.Objects; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Customer.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Customer.java similarity index 96% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Customer.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Customer.java index e79d5a49b696..a1395e5be571 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Customer.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Customer.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.domain; +package com.azure.spring.data.cosmos.domain; import org.springframework.data.annotation.Id; @@ -15,6 +15,9 @@ public class Customer { private User user; + public Customer() { + } + public Customer(String id, Long level, User user) { this.id = id; this.level = level; @@ -83,6 +86,9 @@ public static class User { private Long age; + public User() { + } + public User(String name, Long age) { this.name = name; this.age = age; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Importance.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Importance.java similarity index 72% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Importance.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Importance.java index 0362ff9c4a43..8d4731c396cf 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Importance.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Importance.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.domain; +package com.azure.spring.data.cosmos.domain; public enum Importance { HIGH, LOW, NORMAL; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/IntegerIdDomain.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/IntegerIdDomain.java similarity index 91% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/IntegerIdDomain.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/IntegerIdDomain.java index 0dc90ea96a1d..e676cb962a9a 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/IntegerIdDomain.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/IntegerIdDomain.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.domain; +package com.azure.spring.data.cosmos.domain; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.Document; +import com.azure.spring.data.cosmos.core.mapping.Document; import org.springframework.data.annotation.Id; import java.util.Objects; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Memo.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Memo.java similarity index 93% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Memo.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Memo.java index 998b03810ef3..4e93a6fb523b 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Memo.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Memo.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.domain; +package com.azure.spring.data.cosmos.domain; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.Document; +import com.azure.spring.data.cosmos.core.mapping.Document; import java.util.Date; import java.util.Objects; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/NoDBAnnotationPerson.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/NoDBAnnotationPerson.java similarity index 96% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/NoDBAnnotationPerson.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/NoDBAnnotationPerson.java index ef76b39d97c2..8bc73b7b3a96 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/NoDBAnnotationPerson.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/NoDBAnnotationPerson.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.domain; +package com.azure.spring.data.cosmos.domain; import java.util.List; @@ -14,6 +14,9 @@ public class NoDBAnnotationPerson { private List hobbies; private List
shippingAddresses; + public NoDBAnnotationPerson() { + } + public NoDBAnnotationPerson(String id, String firstName, String lastName, List hobbies, List
shippingAddresses) { this.id = id; this.firstName = firstName; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/PageableAddress.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/PageableAddress.java similarity index 89% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/PageableAddress.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/PageableAddress.java index 947b30baf43c..686661e3b670 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/PageableAddress.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/PageableAddress.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.domain; +package com.azure.spring.data.cosmos.domain; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.Document; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.PartitionKey; +import com.azure.spring.data.cosmos.core.mapping.Document; +import com.azure.spring.data.cosmos.core.mapping.PartitionKey; import org.springframework.data.annotation.Id; import java.util.Objects; @@ -35,6 +35,9 @@ public int hashCode() { return Objects.hash(postalCode, street, city); } + public PageableAddress() { + } + public PageableAddress(String postalCode, String street, String city) { this.postalCode = postalCode; this.street = street; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/PageableMemo.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/PageableMemo.java similarity index 93% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/PageableMemo.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/PageableMemo.java index 5796f18e8af7..b16a0dc8ee80 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/PageableMemo.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/PageableMemo.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.domain; +package com.azure.spring.data.cosmos.domain; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.Document; +import com.azure.spring.data.cosmos.core.mapping.Document; import java.util.Date; import java.util.Objects; @@ -17,6 +17,9 @@ public class PageableMemo { private Date date; private Importance importance; + public PageableMemo() { + } + public PageableMemo(String id, String message, Date date, Importance importance) { this.id = id; this.message = message; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/PageablePerson.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/PageablePerson.java similarity index 89% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/PageablePerson.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/PageablePerson.java index 44ac9016bbf9..ad7d2197baf4 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/PageablePerson.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/PageablePerson.java @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.domain; +package com.azure.spring.data.cosmos.domain; -import com.microsoft.azure.spring.data.cosmosdb.common.TestConstants; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.Document; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.DocumentIndexingPolicy; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.PartitionKey; +import com.azure.spring.data.cosmos.core.mapping.Document; +import com.azure.spring.data.cosmos.core.mapping.DocumentIndexingPolicy; +import com.azure.spring.data.cosmos.core.mapping.PartitionKey; +import com.azure.spring.data.cosmos.common.TestConstants; import org.springframework.data.annotation.Version; import java.util.List; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/PartitionPerson.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/PartitionPerson.java similarity index 92% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/PartitionPerson.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/PartitionPerson.java index fefe9b080a9d..1470343f063f 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/PartitionPerson.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/PartitionPerson.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.domain; +package com.azure.spring.data.cosmos.domain; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.Document; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.PartitionKey; +import com.azure.spring.data.cosmos.core.mapping.Document; +import com.azure.spring.data.cosmos.core.mapping.PartitionKey; import java.util.List; import java.util.Objects; @@ -22,6 +22,9 @@ public class PartitionPerson { private List
shippingAddresses; + public PartitionPerson() { + } + public PartitionPerson(String id, String firstName, String lastName, List hobbies, List
shippingAddresses) { this.id = id; this.firstName = firstName; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Person.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Person.java similarity index 89% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Person.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Person.java index 8038c1826df0..3a4a64b55ed0 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Person.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Person.java @@ -1,18 +1,17 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.domain; +package com.azure.spring.data.cosmos.domain; + +import com.azure.spring.data.cosmos.core.mapping.Document; +import com.azure.spring.data.cosmos.core.mapping.DocumentIndexingPolicy; +import com.azure.spring.data.cosmos.core.mapping.PartitionKey; +import com.azure.spring.data.cosmos.common.TestConstants; +import org.springframework.data.annotation.Version; import java.util.List; import java.util.Objects; -import com.microsoft.azure.spring.data.cosmosdb.common.TestConstants; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.Document; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.DocumentIndexingPolicy; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.PartitionKey; - -import org.springframework.data.annotation.Version; - @Document() @DocumentIndexingPolicy(includePaths = TestConstants.ORDER_BY_STRING_PATH) public class Person { diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Project.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Project.java similarity index 88% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Project.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Project.java index 436b040198fa..77b75e914258 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Project.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Project.java @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.domain; +package com.azure.spring.data.cosmos.domain; -import com.microsoft.azure.spring.data.cosmosdb.common.TestConstants; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.Document; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.DocumentIndexingPolicy; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.PartitionKey; +import com.azure.spring.data.cosmos.core.mapping.Document; +import com.azure.spring.data.cosmos.core.mapping.DocumentIndexingPolicy; +import com.azure.spring.data.cosmos.core.mapping.PartitionKey; +import com.azure.spring.data.cosmos.common.TestConstants; import org.springframework.data.annotation.Id; import java.util.Objects; @@ -28,6 +28,9 @@ public class Project { private Long forkCount; + public Project() { + } + public Project(String id, String name, String creator, Boolean hasReleased, Long starCount, Long forkCount) { this.id = id; this.name = name; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Question.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Question.java similarity index 83% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Question.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Question.java index 541b32fab8f0..2c1c9f6a6384 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Question.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Question.java @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.domain; +package com.azure.spring.data.cosmos.domain; import com.azure.data.cosmos.IndexingMode; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.Document; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.DocumentIndexingPolicy; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.PartitionKey; +import com.azure.spring.data.cosmos.core.mapping.Document; +import com.azure.spring.data.cosmos.core.mapping.DocumentIndexingPolicy; +import com.azure.spring.data.cosmos.core.mapping.PartitionKey; import org.springframework.data.annotation.Id; import java.util.Objects; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Role.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Role.java similarity index 85% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Role.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Role.java index 6bc7ca4233d0..1e04be72330f 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Role.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Role.java @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.domain; +package com.azure.spring.data.cosmos.domain; import com.azure.data.cosmos.IndexingMode; -import com.microsoft.azure.spring.data.cosmosdb.common.TestConstants; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.Document; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.DocumentIndexingPolicy; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.PartitionKey; +import com.azure.spring.data.cosmos.core.mapping.Document; +import com.azure.spring.data.cosmos.core.mapping.DocumentIndexingPolicy; +import com.azure.spring.data.cosmos.core.mapping.PartitionKey; +import com.azure.spring.data.cosmos.common.TestConstants; import org.springframework.data.annotation.Id; import java.util.Objects; @@ -34,6 +34,9 @@ public class Role { String level; + public Role() { + } + public Role(String id, String name, String level) { this.id = id; this.name = name; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/SortedProject.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/SortedProject.java similarity index 88% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/SortedProject.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/SortedProject.java index 38437509175d..4bf8d7528f75 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/SortedProject.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/SortedProject.java @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.domain; +package com.azure.spring.data.cosmos.domain; -import com.microsoft.azure.spring.data.cosmosdb.common.TestConstants; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.Document; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.DocumentIndexingPolicy; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.PartitionKey; +import com.azure.spring.data.cosmos.core.mapping.Document; +import com.azure.spring.data.cosmos.core.mapping.DocumentIndexingPolicy; +import com.azure.spring.data.cosmos.core.mapping.PartitionKey; +import com.azure.spring.data.cosmos.common.TestConstants; import org.springframework.data.annotation.Id; import java.util.Objects; @@ -28,6 +28,9 @@ public class SortedProject { private Long forkCount; + public SortedProject() { + } + public SortedProject(String id, String name, String creator, Boolean hasReleased, Long starCount, Long forkCount) { this.id = id; this.name = name; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/SpELBeanStudent.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/SpELBeanStudent.java similarity index 93% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/SpELBeanStudent.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/SpELBeanStudent.java index eb698245156f..d426b7c241e7 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/SpELBeanStudent.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/SpELBeanStudent.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.domain; +package com.azure.spring.data.cosmos.domain; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.Document; +import com.azure.spring.data.cosmos.core.mapping.Document; import java.util.Objects; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/SpELPropertyStudent.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/SpELPropertyStudent.java similarity index 93% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/SpELPropertyStudent.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/SpELPropertyStudent.java index 83daf0e542d2..5d1a74296ad9 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/SpELPropertyStudent.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/SpELPropertyStudent.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.domain; +package com.azure.spring.data.cosmos.domain; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.Document; +import com.azure.spring.data.cosmos.core.mapping.Document; import java.util.Objects; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Student.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Student.java similarity index 89% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Student.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Student.java index 6e8057275916..d3473617dcd7 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/Student.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/Student.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.domain; +package com.azure.spring.data.cosmos.domain; -import com.microsoft.azure.spring.data.cosmosdb.common.TestConstants; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.DocumentIndexingPolicy; +import com.azure.spring.data.cosmos.core.mapping.DocumentIndexingPolicy; +import com.azure.spring.data.cosmos.common.TestConstants; import java.util.Objects; @@ -14,6 +14,9 @@ public class Student { private String firstName; private String lastName; + public Student() { + } + public Student(String id, String firstName, String lastName) { this.id = id; this.firstName = firstName; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/TimeToLiveSample.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/TimeToLiveSample.java similarity index 66% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/TimeToLiveSample.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/TimeToLiveSample.java index 3a6093ec6b6f..5c1a97acf7ab 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/TimeToLiveSample.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/TimeToLiveSample.java @@ -1,14 +1,17 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.domain; +package com.azure.spring.data.cosmos.domain; -import com.microsoft.azure.spring.data.cosmosdb.common.TestConstants; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.Document; +import com.azure.spring.data.cosmos.core.mapping.Document; +import com.azure.spring.data.cosmos.common.TestConstants; @Document(timeToLive = TestConstants.TIME_TO_LIVE) public class TimeToLiveSample { private String id; + public TimeToLiveSample() { + } + public TimeToLiveSample(String id) { this.id = id; } diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/inheritance/Shape.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/inheritance/Shape.java similarity index 92% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/inheritance/Shape.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/inheritance/Shape.java index 5166e51fb51f..3ea83f1ba91a 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/inheritance/Shape.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/inheritance/Shape.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.domain.inheritance; +package com.azure.spring.data.cosmos.domain.inheritance; import java.util.Objects; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/inheritance/Square.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/inheritance/Square.java similarity index 95% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/inheritance/Square.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/inheritance/Square.java index e82e168f8fc6..b96d38c4d837 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/domain/inheritance/Square.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/domain/inheritance/Square.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.domain.inheritance; +package com.azure.spring.data.cosmos.domain.inheritance; import org.springframework.data.annotation.Id; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/PerfConfiguration.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/PerfConfiguration.java similarity index 67% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/PerfConfiguration.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/PerfConfiguration.java index d893bbc89282..d80a8c02da40 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/PerfConfiguration.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/PerfConfiguration.java @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.performance; +package com.azure.spring.data.cosmos.performance; -import com.microsoft.azure.spring.data.cosmosdb.config.AbstractCosmosConfiguration; -import com.microsoft.azure.spring.data.cosmosdb.config.CosmosDBConfig; -import com.microsoft.azure.spring.data.cosmosdb.performance.utils.Constants; -import com.microsoft.azure.spring.data.cosmosdb.repository.config.EnableCosmosRepositories; +import com.azure.spring.data.cosmos.config.AbstractCosmosConfiguration; +import com.azure.spring.data.cosmos.config.CosmosDBConfig; +import com.azure.spring.data.cosmos.performance.utils.Constants; +import com.azure.spring.data.cosmos.repository.config.EnableCosmosRepositories; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/PerformanceCompare.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/PerformanceCompare.java similarity index 70% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/PerformanceCompare.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/PerformanceCompare.java index 97d7698ecf54..14256feed345 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/PerformanceCompare.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/PerformanceCompare.java @@ -1,17 +1,18 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.performance; +package com.azure.spring.data.cosmos.performance; import com.azure.data.cosmos.CosmosClient; import com.azure.data.cosmos.CosmosClientException; import com.azure.data.cosmos.sync.CosmosSyncClient; -import com.microsoft.azure.spring.data.cosmosdb.core.query.CosmosPageRequest; -import com.microsoft.azure.spring.data.cosmosdb.performance.domain.PerfPerson; -import com.microsoft.azure.spring.data.cosmosdb.performance.repository.PerfPersonRepository; -import com.microsoft.azure.spring.data.cosmosdb.performance.service.SdkService; -import com.microsoft.azure.spring.data.cosmosdb.performance.utils.Constants; -import com.microsoft.azure.spring.data.cosmosdb.performance.utils.DatabaseUtils; -import com.microsoft.azure.spring.data.cosmosdb.performance.utils.PerfDataProvider; +import com.azure.spring.data.cosmos.core.query.CosmosPageRequest; +import com.azure.spring.data.cosmos.performance.domain.PerfPerson; +import com.azure.spring.data.cosmos.performance.repository.PerfPersonRepository; +import com.azure.spring.data.cosmos.performance.service.SdkService; +import com.azure.spring.data.cosmos.performance.utils.Constants; +import com.azure.spring.data.cosmos.performance.utils.DatabaseUtils; +import com.azure.spring.data.cosmos.performance.utils.FunctionUtils; +import com.azure.spring.data.cosmos.performance.utils.PerfDataProvider; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; @@ -31,7 +32,6 @@ import java.util.List; import java.util.stream.Collectors; -import static com.microsoft.azure.spring.data.cosmosdb.performance.utils.FunctionUtils.*; import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringJUnit4ClassRunner.class) @@ -98,8 +98,8 @@ public static void printReport() { public void saveOneRecordTest() { final List personList = PerfDataProvider.getPerfData(recurTimes); - final long springCost = applyInputListFunc(personList, repository::save); - final long sdkCost = applyInputListFunc(personList, sdkService::save); + final long springCost = FunctionUtils.applyInputListFunc(personList, repository::save); + final long sdkCost = FunctionUtils.applyInputListFunc(personList, sdkService::save); verifyResult(OperationType.SAVE_ONE, springCost, sdkCost, acceptanceDiff); } @@ -108,8 +108,8 @@ public void saveOneRecordTest() { public void saveMultipleRecordsTest() { final List> personList = PerfDataProvider.getMultiPerfData(batchSize, recurTimes); - final long springCost = acceptInputListFunc(personList, repository::saveAll); - final long sdkCost = acceptInputListFunc(personList, sdkService::saveAll); + final long springCost = FunctionUtils.acceptInputListFunc(personList, repository::saveAll); + final long sdkCost = FunctionUtils.acceptInputListFunc(personList, sdkService::saveAll); verifyResult(OperationType.SAVE_ALL, springCost, sdkCost, acceptanceDiff); } @@ -118,8 +118,8 @@ public void saveMultipleRecordsTest() { public void deleteOneRecordTest() { final List personList = prepareListData(recurTimes); - final long springCost = acceptInputListFunc(personList, repository::delete); - final long sdkCost = acceptInputListFunc(personList, sdkService::delete); + final long springCost = FunctionUtils.acceptInputListFunc(personList, repository::delete); + final long sdkCost = FunctionUtils.acceptInputListFunc(personList, sdkService::delete); verifyResult(OperationType.DELETE_ONE, springCost, sdkCost, acceptanceDiff); } @@ -128,8 +128,8 @@ public void deleteOneRecordTest() { public void deleteAllRecordsTest() { final List> personList = prepareListBatchData(recurTimes, batchSize); - final long springCost = acceptInputListFunc(personList, repository::deleteAll); - final long sdkCost = acceptInputListFunc(personList, sdkService::deleteAll); + final long springCost = FunctionUtils.acceptInputListFunc(personList, repository::deleteAll); + final long sdkCost = FunctionUtils.acceptInputListFunc(personList, sdkService::deleteAll); verifyResult(OperationType.DELETE_ALL, springCost, sdkCost, acceptanceDiff); } @@ -139,8 +139,8 @@ public void findByIdTest() { final List idList = prepareListData(recurTimes).stream().map(PerfPerson::getId) .collect(Collectors.toList()); - final long springCost = applyInputListFunc(idList, repository::findById); - final long sdkCost = applyInputListFunc(idList, sdkService::findById); + final long springCost = FunctionUtils.applyInputListFunc(idList, repository::findById); + final long sdkCost = FunctionUtils.applyInputListFunc(idList, sdkService::findById); verifyResult(OperationType.FIND_BY_ID, springCost, sdkCost, acceptanceDiff); } @@ -149,8 +149,8 @@ public void findByIdTest() { public void findByMultipleIdsTest() { final List> idList = listBatchIds(recurTimes, batchSize); - final long springCost = acceptInputListFunc(idList, repository::findAllById); - final long sdkCost = acceptInputListFunc(idList, sdkService::findAllById); + final long springCost = FunctionUtils.acceptInputListFunc(idList, repository::findAllById); + final long sdkCost = FunctionUtils.acceptInputListFunc(idList, sdkService::findAllById); verifyResult(OperationType.FIND_BY_IDS, springCost, sdkCost, acceptanceDiff); } @@ -159,16 +159,16 @@ public void findByMultipleIdsTest() { public void findAllTest() { prepareListData(recurTimes); - final long springCost = getSupplier(recurTimes, repository::findAll); - final long sdkCost = getSupplier(recurTimes, sdkService::findAll); + final long springCost = FunctionUtils.getSupplier(recurTimes, repository::findAll); + final long sdkCost = FunctionUtils.getSupplier(recurTimes, sdkService::findAll); verifyResult(OperationType.FIND_ALL, springCost, sdkCost, acceptanceDiff); } @Test public void deleteAllTest() { - final long springCost = getSupplier(recurTimes, this::springDeleteAll); - final long sdkCost = getSupplier(recurTimes, sdkService::deleteAll); + final long springCost = FunctionUtils.getSupplier(recurTimes, this::springDeleteAll); + final long sdkCost = FunctionUtils.getSupplier(recurTimes, sdkService::deleteAll); verifyResult(OperationType.DELETE_ALL, springCost, sdkCost, acceptanceDiff); } @@ -180,8 +180,8 @@ public void findBySortingTest() { final Sort sort = Sort.by(Sort.Direction.ASC, "name"); final List sortList = buildSortList(sort, recurTimes); - final long springCost = applyInputListFunc(sortList, repository::findAll); - final long sdkCost = applyInputListFunc(sortList, sdkService::searchDocuments); + final long springCost = FunctionUtils.applyInputListFunc(sortList, repository::findAll); + final long sdkCost = FunctionUtils.applyInputListFunc(sortList, sdkService::searchDocuments); verifyResult(OperationType.FIND_BY_SORT, springCost, sdkCost, acceptanceDiff); } @@ -192,8 +192,8 @@ public void findByPagingTest() { int pageSize = recurTimes / 2; pageSize = pageSize >= 1 ? pageSize : 1; - final long springCost = runConsumerForTimes(recurTimes, pageSize, this::queryTwoPages); - final long sdkCost = runConsumerForTimes(recurTimes, pageSize, sdkService::queryTwoPages); + final long springCost = FunctionUtils.runConsumerForTimes(recurTimes, pageSize, this::queryTwoPages); + final long sdkCost = FunctionUtils.runConsumerForTimes(recurTimes, pageSize, sdkService::queryTwoPages); verifyResult(OperationType.FIND_BY_PAGING, springCost, sdkCost, acceptanceDiff); } @@ -204,8 +204,8 @@ public void findByFieldTest() { final String name = data.get(recurTimes / 2).getName(); - final long springCost = runFunctionForTimes(recurTimes, name, repository::findByName); - final long sdkCost = runConsumerForTimes(recurTimes, name, sdkService::findByName); + final long springCost = FunctionUtils.runFunctionForTimes(recurTimes, name, repository::findByName); + final long sdkCost = FunctionUtils.runConsumerForTimes(recurTimes, name, sdkService::findByName); verifyResult(OperationType.FIND_BY_FIELD, springCost, sdkCost, acceptanceDiff); } @@ -214,8 +214,8 @@ public void findByFieldTest() { public void countTest() { prepareListData(recurTimes); - final long springCost = getSupplier(recurTimes, repository::count); - final long sdkCost = getSupplier(recurTimes, sdkService::count); + final long springCost = FunctionUtils.getSupplier(recurTimes, repository::count); + final long sdkCost = FunctionUtils.getSupplier(recurTimes, sdkService::count); verifyResult(OperationType.COUNT, springCost, sdkCost, acceptanceDiff); } @@ -262,8 +262,8 @@ private void queryTwoPages(int pageSize) { private List prepareListData(int count) { final List personList = PerfDataProvider.getPerfData(count); - applyInputListFunc(personList, repository::save); - applyInputListFunc(personList, sdkService::save); + FunctionUtils.applyInputListFunc(personList, repository::save); + FunctionUtils.applyInputListFunc(personList, sdkService::save); return personList; } @@ -272,8 +272,8 @@ private List prepareListData(int count) { private List> prepareListBatchData(int times, int batchSize) { final List> personList = PerfDataProvider.getMultiPerfData(batchSize, times); - applyInputListFunc(personList, repository::saveAll); - applyInputListFunc(personList, sdkService::saveAll); + FunctionUtils.applyInputListFunc(personList, repository::saveAll); + FunctionUtils.applyInputListFunc(personList, sdkService::saveAll); return personList; } diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/PerformanceReport.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/PerformanceReport.java similarity index 98% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/PerformanceReport.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/PerformanceReport.java index f992d5b16117..7a33933abe82 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/PerformanceReport.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/PerformanceReport.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.performance; +package com.azure.spring.data.cosmos.performance; import java.util.ArrayList; import java.util.List; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/domain/PerfPerson.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/domain/PerfPerson.java similarity index 78% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/domain/PerfPerson.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/domain/PerfPerson.java index 4be9232067b5..eb6e15ba1a07 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/domain/PerfPerson.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/domain/PerfPerson.java @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.performance.domain; +package com.azure.spring.data.cosmos.performance.domain; -import com.microsoft.azure.spring.data.cosmosdb.common.TestConstants; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.Document; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.DocumentIndexingPolicy; -import com.microsoft.azure.spring.data.cosmosdb.performance.utils.Constants; +import com.azure.spring.data.cosmos.core.mapping.Document; +import com.azure.spring.data.cosmos.core.mapping.DocumentIndexingPolicy; +import com.azure.spring.data.cosmos.performance.utils.Constants; +import com.azure.spring.data.cosmos.common.TestConstants; import java.util.Objects; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/repository/PerfPersonRepository.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/repository/PerfPersonRepository.java similarity index 63% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/repository/PerfPersonRepository.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/repository/PerfPersonRepository.java index 7f41ee743800..19cabb78bba7 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/repository/PerfPersonRepository.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/repository/PerfPersonRepository.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.performance.repository; +package com.azure.spring.data.cosmos.performance.repository; -import com.microsoft.azure.spring.data.cosmosdb.performance.domain.PerfPerson; -import com.microsoft.azure.spring.data.cosmosdb.repository.CosmosRepository; +import com.azure.spring.data.cosmos.repository.CosmosRepository; +import com.azure.spring.data.cosmos.performance.domain.PerfPerson; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Repository; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/service/SdkService.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/service/SdkService.java similarity index 94% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/service/SdkService.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/service/SdkService.java index bf5462d42c1a..b9fa8bb4d6b8 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/service/SdkService.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/service/SdkService.java @@ -1,18 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.performance.service; - -import com.azure.data.cosmos.CosmosClient; -import com.azure.data.cosmos.CosmosClientException; -import com.azure.data.cosmos.CosmosItemProperties; -import com.azure.data.cosmos.CosmosItemRequestOptions; -import com.azure.data.cosmos.FeedOptions; -import com.azure.data.cosmos.FeedResponse; -import com.azure.data.cosmos.PartitionKey; +package com.azure.spring.data.cosmos.performance.service; + +import com.azure.data.cosmos.*; import com.azure.data.cosmos.sync.CosmosSyncClient; +import com.azure.spring.data.cosmos.performance.utils.DatabaseUtils; import com.google.gson.Gson; -import com.microsoft.azure.spring.data.cosmosdb.performance.domain.PerfPerson; -import com.microsoft.azure.spring.data.cosmosdb.performance.utils.DatabaseUtils; +import com.azure.spring.data.cosmos.performance.domain.PerfPerson; import org.assertj.core.util.Lists; import org.springframework.data.domain.Sort; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/utils/Constants.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/utils/Constants.java similarity index 83% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/utils/Constants.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/utils/Constants.java index 0813cd7fb40d..24061701bdb9 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/utils/Constants.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/utils/Constants.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.performance.utils; +package com.azure.spring.data.cosmos.performance.utils; public class Constants { public static final String PERF_DATABASE_NAME = "perf_database"; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/utils/DatabaseUtils.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/utils/DatabaseUtils.java similarity index 83% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/utils/DatabaseUtils.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/utils/DatabaseUtils.java index 061e6a97e4d5..14ced00fcd8f 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/utils/DatabaseUtils.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/utils/DatabaseUtils.java @@ -1,18 +1,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.performance.utils; +package com.azure.spring.data.cosmos.performance.utils; -import com.azure.data.cosmos.CosmosClientException; -import com.azure.data.cosmos.CosmosContainerProperties; -import com.azure.data.cosmos.IncludedPath; -import com.azure.data.cosmos.IndexingPolicy; -import com.azure.data.cosmos.PartitionKeyDefinition; +import com.azure.data.cosmos.*; import com.azure.data.cosmos.internal.RequestOptions; import com.azure.data.cosmos.sync.CosmosSyncClient; import java.util.Collections; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.ORDER_BY_STRING_PATH; +import static com.azure.spring.data.cosmos.common.TestConstants.ORDER_BY_STRING_PATH; public class DatabaseUtils { public static void createDatabase(CosmosSyncClient documentClient, String databaseName) diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/utils/FunctionUtils.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/utils/FunctionUtils.java similarity index 98% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/utils/FunctionUtils.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/utils/FunctionUtils.java index ba890c121215..52b1759d334c 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/utils/FunctionUtils.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/utils/FunctionUtils.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.performance.utils; +package com.azure.spring.data.cosmos.performance.utils; import java.util.List; import java.util.function.Consumer; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/utils/PerfDataProvider.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/utils/PerfDataProvider.java similarity index 88% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/utils/PerfDataProvider.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/utils/PerfDataProvider.java index 3c5472ca8465..7f79f5d70b26 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/performance/utils/PerfDataProvider.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/performance/utils/PerfDataProvider.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.performance.utils; +package com.azure.spring.data.cosmos.performance.utils; -import com.microsoft.azure.spring.data.cosmosdb.performance.domain.PerfPerson; +import com.azure.spring.data.cosmos.performance.domain.PerfPerson; import org.assertj.core.util.Lists; import java.util.List; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/CosmosAnnotationUnitTest.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/CosmosAnnotationUnitTest.java similarity index 89% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/CosmosAnnotationUnitTest.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/CosmosAnnotationUnitTest.java index 920fc29a5327..0ffa19fb7a73 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/CosmosAnnotationUnitTest.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/CosmosAnnotationUnitTest.java @@ -1,16 +1,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository; +package com.azure.spring.data.cosmos.repository; import com.azure.data.cosmos.IndexingPolicy; -import com.microsoft.azure.spring.data.cosmosdb.common.TestConstants; -import com.microsoft.azure.spring.data.cosmosdb.common.TestUtils; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.Document; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.DocumentIndexingPolicy; -import com.microsoft.azure.spring.data.cosmosdb.domain.NoDBAnnotationPerson; -import com.microsoft.azure.spring.data.cosmosdb.domain.Role; -import com.microsoft.azure.spring.data.cosmosdb.domain.TimeToLiveSample; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.core.mapping.Document; +import com.azure.spring.data.cosmos.core.mapping.DocumentIndexingPolicy; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.common.TestConstants; +import com.azure.spring.data.cosmos.common.TestUtils; +import com.azure.spring.data.cosmos.domain.NoDBAnnotationPerson; +import com.azure.spring.data.cosmos.domain.Role; +import com.azure.spring.data.cosmos.domain.TimeToLiveSample; import org.junit.Before; import org.junit.Test; import org.springframework.util.Assert; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/SimpleCosmosRepositoryIllegalTest.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/SimpleCosmosRepositoryIllegalTest.java similarity index 82% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/SimpleCosmosRepositoryIllegalTest.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/SimpleCosmosRepositoryIllegalTest.java index 117d3bbf74ae..39291c39e1cd 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/SimpleCosmosRepositoryIllegalTest.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/SimpleCosmosRepositoryIllegalTest.java @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository; +package com.azure.spring.data.cosmos.repository; -import com.microsoft.azure.spring.data.cosmosdb.core.CosmosOperations; -import com.microsoft.azure.spring.data.cosmosdb.domain.Person; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.SimpleCosmosRepository; +import com.azure.spring.data.cosmos.core.CosmosOperations; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.repository.support.SimpleCosmosRepository; +import com.azure.spring.data.cosmos.domain.Person; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/SimpleCosmosRepositoryUnitTest.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/SimpleCosmosRepositoryUnitTest.java similarity index 87% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/SimpleCosmosRepositoryUnitTest.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/SimpleCosmosRepositoryUnitTest.java index 6ec48cb66bc3..80cb570fe988 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/SimpleCosmosRepositoryUnitTest.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/SimpleCosmosRepositoryUnitTest.java @@ -1,14 +1,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository; - -import com.microsoft.azure.spring.data.cosmosdb.common.TestConstants; -import com.microsoft.azure.spring.data.cosmosdb.core.CosmosOperations; -import com.microsoft.azure.spring.data.cosmosdb.domain.Address; -import com.microsoft.azure.spring.data.cosmosdb.domain.Person; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.SimpleCosmosRepository; +package com.azure.spring.data.cosmos.repository; + +import com.azure.spring.data.cosmos.core.CosmosOperations; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.repository.support.SimpleCosmosRepository; +import com.azure.spring.data.cosmos.common.TestConstants; +import com.azure.spring.data.cosmos.domain.Address; +import com.azure.spring.data.cosmos.domain.Person; import org.assertj.core.util.Lists; import org.junit.Before; import org.junit.Rule; @@ -22,8 +22,8 @@ import java.util.List; import static org.junit.Assert.assertEquals; -import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/TestRepositoryConfig.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/TestRepositoryConfig.java similarity index 79% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/TestRepositoryConfig.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/TestRepositoryConfig.java index 7079a4683ec6..2556f379aa8e 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/TestRepositoryConfig.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/TestRepositoryConfig.java @@ -1,16 +1,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository; +package com.azure.spring.data.cosmos.repository; import com.azure.data.cosmos.ConsistencyLevel; import com.azure.data.cosmos.internal.RequestOptions; -import com.microsoft.azure.spring.data.cosmosdb.common.DynamicContainer; -import com.microsoft.azure.spring.data.cosmosdb.common.ResponseDiagnosticsTestUtils; -import com.microsoft.azure.spring.data.cosmosdb.common.TestConstants; -import com.microsoft.azure.spring.data.cosmosdb.config.AbstractCosmosConfiguration; -import com.microsoft.azure.spring.data.cosmosdb.config.CosmosDBConfig; -import com.microsoft.azure.spring.data.cosmosdb.repository.config.EnableCosmosRepositories; -import com.microsoft.azure.spring.data.cosmosdb.repository.config.EnableReactiveCosmosRepositories; +import com.azure.spring.data.cosmos.config.AbstractCosmosConfiguration; +import com.azure.spring.data.cosmos.config.CosmosDBConfig; +import com.azure.spring.data.cosmos.repository.config.EnableCosmosRepositories; +import com.azure.spring.data.cosmos.repository.config.EnableReactiveCosmosRepositories; +import com.azure.spring.data.cosmos.common.DynamicContainer; +import com.azure.spring.data.cosmos.common.ResponseDiagnosticsTestUtils; +import com.azure.spring.data.cosmos.common.TestConstants; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/CosmosRepositoryConfigurationExtensionUnitTest.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/config/CosmosRepositoryConfigurationExtensionUnitTest.java similarity index 94% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/CosmosRepositoryConfigurationExtensionUnitTest.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/config/CosmosRepositoryConfigurationExtensionUnitTest.java index b6960ab484c3..440cc1d93be9 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/CosmosRepositoryConfigurationExtensionUnitTest.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/config/CosmosRepositoryConfigurationExtensionUnitTest.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.config; +package com.azure.spring.data.cosmos.repository.config; -import com.microsoft.azure.spring.data.cosmosdb.repository.CosmosRepository; +import com.azure.spring.data.cosmos.repository.CosmosRepository; import org.junit.Test; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.core.env.Environment; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/ReactiveCosmosRepositoryConfigurationExtensionUnitTest.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/config/ReactiveCosmosRepositoryConfigurationExtensionUnitTest.java similarity index 94% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/ReactiveCosmosRepositoryConfigurationExtensionUnitTest.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/config/ReactiveCosmosRepositoryConfigurationExtensionUnitTest.java index 1e32fb0fe25b..30b78a63900e 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/config/ReactiveCosmosRepositoryConfigurationExtensionUnitTest.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/config/ReactiveCosmosRepositoryConfigurationExtensionUnitTest.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.config; +package com.azure.spring.data.cosmos.repository.config; -import com.microsoft.azure.spring.data.cosmosdb.repository.ReactiveCosmosRepository; +import com.azure.spring.data.cosmos.repository.ReactiveCosmosRepository; import org.junit.Test; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.core.env.Environment; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/AddressRepositoryIT.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/AddressRepositoryIT.java similarity index 91% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/AddressRepositoryIT.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/AddressRepositoryIT.java index 78526ac34dd6..0a78bfebcbe8 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/AddressRepositoryIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/AddressRepositoryIT.java @@ -1,22 +1,17 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.integration; +package com.azure.spring.data.cosmos.repository.integration; import com.azure.data.cosmos.PartitionKey; -import com.microsoft.azure.spring.data.cosmosdb.common.TestConstants; -import com.microsoft.azure.spring.data.cosmosdb.common.TestUtils; -import com.microsoft.azure.spring.data.cosmosdb.core.CosmosTemplate; -import com.microsoft.azure.spring.data.cosmosdb.domain.Address; -import com.microsoft.azure.spring.data.cosmosdb.repository.TestRepositoryConfig; -import com.microsoft.azure.spring.data.cosmosdb.repository.repository.AddressRepository; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.core.CosmosTemplate; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.common.TestConstants; +import com.azure.spring.data.cosmos.common.TestUtils; +import com.azure.spring.data.cosmos.domain.Address; +import com.azure.spring.data.cosmos.repository.TestRepositoryConfig; +import com.azure.spring.data.cosmos.repository.repository.AddressRepository; import org.assertj.core.util.Lists; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; +import org.junit.*; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/ContactRepositoryIT.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/ContactRepositoryIT.java similarity index 90% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/ContactRepositoryIT.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/ContactRepositoryIT.java index ca4368e987c0..bbcb0aedadfc 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/ContactRepositoryIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/ContactRepositoryIT.java @@ -1,20 +1,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.integration; - -import com.microsoft.azure.spring.data.cosmosdb.common.TestUtils; -import com.microsoft.azure.spring.data.cosmosdb.core.CosmosTemplate; -import com.microsoft.azure.spring.data.cosmosdb.domain.Contact; -import com.microsoft.azure.spring.data.cosmosdb.repository.TestRepositoryConfig; -import com.microsoft.azure.spring.data.cosmosdb.repository.repository.ContactRepository; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; +package com.azure.spring.data.cosmos.repository.integration; + +import com.azure.spring.data.cosmos.core.CosmosTemplate; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.common.TestUtils; +import com.azure.spring.data.cosmos.domain.Contact; +import com.azure.spring.data.cosmos.repository.TestRepositoryConfig; +import com.azure.spring.data.cosmos.repository.repository.ContactRepository; import org.assertj.core.util.Lists; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.*; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/CosmosAnnotationIT.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/CosmosAnnotationIT.java similarity index 81% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/CosmosAnnotationIT.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/CosmosAnnotationIT.java index 943dfe2072bc..7c5253e0c118 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/CosmosAnnotationIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/CosmosAnnotationIT.java @@ -1,20 +1,20 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.integration; +package com.azure.spring.data.cosmos.repository.integration; import com.azure.data.cosmos.CosmosContainerProperties; import com.azure.data.cosmos.IndexingPolicy; -import com.microsoft.azure.spring.data.cosmosdb.CosmosDbFactory; -import com.microsoft.azure.spring.data.cosmosdb.common.TestConstants; -import com.microsoft.azure.spring.data.cosmosdb.common.TestUtils; -import com.microsoft.azure.spring.data.cosmosdb.config.CosmosDBConfig; -import com.microsoft.azure.spring.data.cosmosdb.core.CosmosTemplate; -import com.microsoft.azure.spring.data.cosmosdb.core.convert.MappingCosmosConverter; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.CosmosMappingContext; -import com.microsoft.azure.spring.data.cosmosdb.domain.Role; -import com.microsoft.azure.spring.data.cosmosdb.domain.TimeToLiveSample; -import com.microsoft.azure.spring.data.cosmosdb.repository.TestRepositoryConfig; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.CosmosDbFactory; +import com.azure.spring.data.cosmos.config.CosmosDBConfig; +import com.azure.spring.data.cosmos.core.CosmosTemplate; +import com.azure.spring.data.cosmos.core.convert.MappingCosmosConverter; +import com.azure.spring.data.cosmos.core.mapping.CosmosMappingContext; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.common.TestConstants; +import com.azure.spring.data.cosmos.common.TestUtils; +import com.azure.spring.data.cosmos.domain.Role; +import com.azure.spring.data.cosmos.domain.TimeToLiveSample; +import com.azure.spring.data.cosmos.repository.TestRepositoryConfig; import org.junit.AfterClass; import org.junit.Before; import org.junit.Ignore; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/CustomerRepositoryIT.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/CustomerRepositoryIT.java similarity index 84% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/CustomerRepositoryIT.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/CustomerRepositoryIT.java index c476c4a57d0e..5b2eb1866a5e 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/CustomerRepositoryIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/CustomerRepositoryIT.java @@ -1,17 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.integration; - -import com.microsoft.azure.spring.data.cosmosdb.core.CosmosTemplate; -import com.microsoft.azure.spring.data.cosmosdb.domain.Customer; -import com.microsoft.azure.spring.data.cosmosdb.repository.TestRepositoryConfig; -import com.microsoft.azure.spring.data.cosmosdb.repository.repository.CustomerRepository; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +package com.azure.spring.data.cosmos.repository.integration; + +import com.azure.spring.data.cosmos.core.CosmosTemplate; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.domain.Customer; +import com.azure.spring.data.cosmos.repository.TestRepositoryConfig; +import com.azure.spring.data.cosmos.repository.repository.CustomerRepository; +import org.junit.*; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.lang.NonNull; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/IntegerIdDomainRepositoryIT.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/IntegerIdDomainRepositoryIT.java similarity index 91% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/IntegerIdDomainRepositoryIT.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/IntegerIdDomainRepositoryIT.java index 67573dd759f6..ec95314fb903 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/IntegerIdDomainRepositoryIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/IntegerIdDomainRepositoryIT.java @@ -1,20 +1,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.integration; - -import com.microsoft.azure.spring.data.cosmosdb.core.CosmosTemplate; -import com.microsoft.azure.spring.data.cosmosdb.core.query.CosmosPageRequest; -import com.microsoft.azure.spring.data.cosmosdb.domain.IntegerIdDomain; -import com.microsoft.azure.spring.data.cosmosdb.exception.CosmosDBAccessException; -import com.microsoft.azure.spring.data.cosmosdb.repository.TestRepositoryConfig; -import com.microsoft.azure.spring.data.cosmosdb.repository.repository.IntegerIdDomainRepository; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +package com.azure.spring.data.cosmos.repository.integration; + +import com.azure.spring.data.cosmos.core.CosmosTemplate; +import com.azure.spring.data.cosmos.core.query.CosmosPageRequest; +import com.azure.spring.data.cosmos.exception.CosmosDBAccessException; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.domain.IntegerIdDomain; +import com.azure.spring.data.cosmos.repository.TestRepositoryConfig; +import com.azure.spring.data.cosmos.repository.repository.IntegerIdDomainRepository; +import org.junit.*; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; @@ -215,6 +210,9 @@ private static class InvalidDomain { private String location; + InvalidDomain() { + } + InvalidDomain(int count, String location) { this.count = count; this.location = location; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/MemoRepositoryIT.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/MemoRepositoryIT.java similarity index 90% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/MemoRepositoryIT.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/MemoRepositoryIT.java index 4fa4053db39b..11e0a8a504dd 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/MemoRepositoryIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/MemoRepositoryIT.java @@ -1,23 +1,17 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.integration; - -import com.microsoft.azure.spring.data.cosmosdb.common.TestConstants; -import com.microsoft.azure.spring.data.cosmosdb.common.TestUtils; -import com.microsoft.azure.spring.data.cosmosdb.core.CosmosTemplate; -import com.microsoft.azure.spring.data.cosmosdb.domain.Importance; -import com.microsoft.azure.spring.data.cosmosdb.domain.Memo; -import com.microsoft.azure.spring.data.cosmosdb.exception.CosmosDBAccessException; -import com.microsoft.azure.spring.data.cosmosdb.repository.TestRepositoryConfig; -import com.microsoft.azure.spring.data.cosmosdb.repository.repository.MemoRepository; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; +package com.azure.spring.data.cosmos.repository.integration; + +import com.azure.spring.data.cosmos.core.CosmosTemplate; +import com.azure.spring.data.cosmos.exception.CosmosDBAccessException; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.common.TestConstants; +import com.azure.spring.data.cosmos.common.TestUtils; +import com.azure.spring.data.cosmos.domain.Importance; +import com.azure.spring.data.cosmos.domain.Memo; +import com.azure.spring.data.cosmos.repository.TestRepositoryConfig; +import com.azure.spring.data.cosmos.repository.repository.MemoRepository; +import org.junit.*; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/PageableAddressRepositoryIT.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/PageableAddressRepositoryIT.java similarity index 87% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/PageableAddressRepositoryIT.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/PageableAddressRepositoryIT.java index 7e1d9a984a34..dee802834c9a 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/PageableAddressRepositoryIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/PageableAddressRepositoryIT.java @@ -1,20 +1,20 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.integration; +package com.azure.spring.data.cosmos.repository.integration; import com.azure.data.cosmos.CosmosClient; import com.azure.data.cosmos.CosmosItemProperties; import com.azure.data.cosmos.FeedOptions; import com.azure.data.cosmos.FeedResponse; -import com.microsoft.azure.spring.data.cosmosdb.common.TestConstants; -import com.microsoft.azure.spring.data.cosmosdb.common.TestUtils; -import com.microsoft.azure.spring.data.cosmosdb.config.CosmosDBConfig; -import com.microsoft.azure.spring.data.cosmosdb.core.CosmosTemplate; -import com.microsoft.azure.spring.data.cosmosdb.core.query.CosmosPageRequest; -import com.microsoft.azure.spring.data.cosmosdb.domain.PageableAddress; -import com.microsoft.azure.spring.data.cosmosdb.repository.TestRepositoryConfig; -import com.microsoft.azure.spring.data.cosmosdb.repository.repository.PageableAddressRepository; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.config.CosmosDBConfig; +import com.azure.spring.data.cosmos.core.CosmosTemplate; +import com.azure.spring.data.cosmos.core.query.CosmosPageRequest; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.common.TestConstants; +import com.azure.spring.data.cosmos.common.TestUtils; +import com.azure.spring.data.cosmos.domain.PageableAddress; +import com.azure.spring.data.cosmos.repository.TestRepositoryConfig; +import com.azure.spring.data.cosmos.repository.repository.PageableAddressRepository; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; @@ -31,10 +31,10 @@ import java.util.ArrayList; import java.util.List; -import static com.microsoft.azure.spring.data.cosmosdb.common.PageTestUtils.validateLastPage; -import static com.microsoft.azure.spring.data.cosmosdb.common.PageTestUtils.validateNonLastPage; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.PAGE_SIZE_1; -import static com.microsoft.azure.spring.data.cosmosdb.common.TestConstants.PAGE_SIZE_3; +import static com.azure.spring.data.cosmos.common.PageTestUtils.validateLastPage; +import static com.azure.spring.data.cosmos.common.PageTestUtils.validateNonLastPage; +import static com.azure.spring.data.cosmos.common.TestConstants.PAGE_SIZE_1; +import static com.azure.spring.data.cosmos.common.TestConstants.PAGE_SIZE_3; import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringJUnit4ClassRunner.class) diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/PageableMemoRepositoryIT.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/PageableMemoRepositoryIT.java similarity index 86% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/PageableMemoRepositoryIT.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/PageableMemoRepositoryIT.java index 35e4a60ee519..a941af82390b 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/PageableMemoRepositoryIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/PageableMemoRepositoryIT.java @@ -1,19 +1,19 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.integration; +package com.azure.spring.data.cosmos.repository.integration; import com.azure.data.cosmos.CosmosClient; import com.azure.data.cosmos.CosmosItemProperties; import com.azure.data.cosmos.FeedOptions; import com.azure.data.cosmos.FeedResponse; -import com.microsoft.azure.spring.data.cosmosdb.config.CosmosDBConfig; -import com.microsoft.azure.spring.data.cosmosdb.core.CosmosTemplate; -import com.microsoft.azure.spring.data.cosmosdb.core.query.CosmosPageRequest; -import com.microsoft.azure.spring.data.cosmosdb.domain.Importance; -import com.microsoft.azure.spring.data.cosmosdb.domain.PageableMemo; -import com.microsoft.azure.spring.data.cosmosdb.repository.TestRepositoryConfig; -import com.microsoft.azure.spring.data.cosmosdb.repository.repository.PageableMemoRepository; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.config.CosmosDBConfig; +import com.azure.spring.data.cosmos.core.CosmosTemplate; +import com.azure.spring.data.cosmos.core.query.CosmosPageRequest; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.domain.Importance; +import com.azure.spring.data.cosmos.domain.PageableMemo; +import com.azure.spring.data.cosmos.repository.TestRepositoryConfig; +import com.azure.spring.data.cosmos.repository.repository.PageableMemoRepository; import org.junit.AfterClass; import org.junit.Before; import org.junit.Test; @@ -27,13 +27,7 @@ import reactor.core.publisher.Flux; import reactor.test.StepVerifier; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Random; -import java.util.Set; -import java.util.UUID; +import java.util.*; import static org.assertj.core.api.Assertions.assertThat; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/PageablePersonRepositoryIT.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/PageablePersonRepositoryIT.java similarity index 85% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/PageablePersonRepositoryIT.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/PageablePersonRepositoryIT.java index bea46dbc742e..20cc38a9ce36 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/PageablePersonRepositoryIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/PageablePersonRepositoryIT.java @@ -1,14 +1,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.integration; - -import com.microsoft.azure.spring.data.cosmosdb.core.CosmosTemplate; -import com.microsoft.azure.spring.data.cosmosdb.core.query.CosmosPageRequest; -import com.microsoft.azure.spring.data.cosmosdb.domain.Address; -import com.microsoft.azure.spring.data.cosmosdb.domain.PageablePerson; -import com.microsoft.azure.spring.data.cosmosdb.repository.TestRepositoryConfig; -import com.microsoft.azure.spring.data.cosmosdb.repository.repository.PageablePersonRepository; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; +package com.azure.spring.data.cosmos.repository.integration; + +import com.azure.spring.data.cosmos.core.CosmosTemplate; +import com.azure.spring.data.cosmos.core.query.CosmosPageRequest; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.domain.Address; +import com.azure.spring.data.cosmos.domain.PageablePerson; +import com.azure.spring.data.cosmos.repository.TestRepositoryConfig; +import com.azure.spring.data.cosmos.repository.repository.PageablePersonRepository; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; import org.junit.AfterClass; @@ -21,11 +21,7 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.UUID; +import java.util.*; import static org.assertj.core.api.Assertions.assertThat; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/PersonRepositoryIT.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/PersonRepositoryIT.java similarity index 64% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/PersonRepositoryIT.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/PersonRepositoryIT.java index 1ffa71649534..e76bab5a1885 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/PersonRepositoryIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/PersonRepositoryIT.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.integration; +package com.azure.spring.data.cosmos.repository.integration; public class PersonRepositoryIT { } diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/ProjectRepositoryIT.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/ProjectRepositoryIT.java similarity index 96% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/ProjectRepositoryIT.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/ProjectRepositoryIT.java index 1e0475d9257d..3910aa2a3be1 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/ProjectRepositoryIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/ProjectRepositoryIT.java @@ -1,30 +1,22 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.integration; +package com.azure.spring.data.cosmos.repository.integration; import com.azure.data.cosmos.PartitionKey; +import com.azure.spring.data.cosmos.core.CosmosTemplate; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; import com.google.common.collect.Lists; -import com.microsoft.azure.spring.data.cosmosdb.core.CosmosTemplate; -import com.microsoft.azure.spring.data.cosmosdb.domain.Project; -import com.microsoft.azure.spring.data.cosmosdb.repository.TestRepositoryConfig; -import com.microsoft.azure.spring.data.cosmosdb.repository.repository.ProjectRepository; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import com.azure.spring.data.cosmos.domain.Project; +import com.azure.spring.data.cosmos.repository.TestRepositoryConfig; +import com.azure.spring.data.cosmos.repository.repository.ProjectRepository; +import org.junit.*; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.lang.NonNull; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import java.util.Optional; +import java.util.*; import static org.assertj.core.api.Assertions.assertThat; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/ProjectRepositorySortIT.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/ProjectRepositorySortIT.java similarity index 91% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/ProjectRepositorySortIT.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/ProjectRepositorySortIT.java index dd952e74dc53..0402c2c9e8c7 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/ProjectRepositorySortIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/ProjectRepositorySortIT.java @@ -1,20 +1,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.integration; - -import com.microsoft.azure.spring.data.cosmosdb.core.CosmosTemplate; -import com.microsoft.azure.spring.data.cosmosdb.core.query.CosmosPageRequest; -import com.microsoft.azure.spring.data.cosmosdb.domain.SortedProject; -import com.microsoft.azure.spring.data.cosmosdb.exception.CosmosDBAccessException; -import com.microsoft.azure.spring.data.cosmosdb.repository.TestRepositoryConfig; -import com.microsoft.azure.spring.data.cosmosdb.repository.repository.SortedProjectRepository; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; +package com.azure.spring.data.cosmos.repository.integration; + +import com.azure.spring.data.cosmos.core.CosmosTemplate; +import com.azure.spring.data.cosmos.core.query.CosmosPageRequest; +import com.azure.spring.data.cosmos.exception.CosmosDBAccessException; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.domain.SortedProject; +import com.azure.spring.data.cosmos.repository.TestRepositoryConfig; +import com.azure.spring.data.cosmos.repository.repository.SortedProjectRepository; import org.assertj.core.util.Lists; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.*; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; @@ -29,7 +25,7 @@ import java.util.stream.Collectors; import java.util.stream.StreamSupport; -import static com.microsoft.azure.spring.data.cosmosdb.common.PageTestUtils.validateLastPage; +import static com.azure.spring.data.cosmos.common.PageTestUtils.validateLastPage; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = TestRepositoryConfig.class) diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/QuestionRepositoryIT.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/QuestionRepositoryIT.java similarity index 79% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/QuestionRepositoryIT.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/QuestionRepositoryIT.java index deba6ec4e626..5410ca9f445e 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/QuestionRepositoryIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/QuestionRepositoryIT.java @@ -1,19 +1,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.integration; - -import com.microsoft.azure.spring.data.cosmosdb.core.CosmosTemplate; -import com.microsoft.azure.spring.data.cosmosdb.domain.Question; -import com.microsoft.azure.spring.data.cosmosdb.repository.TestRepositoryConfig; -import com.microsoft.azure.spring.data.cosmosdb.repository.repository.ProjectRepository; -import com.microsoft.azure.spring.data.cosmosdb.repository.repository.QuestionRepository; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; +package com.azure.spring.data.cosmos.repository.integration; + +import com.azure.spring.data.cosmos.core.CosmosTemplate; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.domain.Question; +import com.azure.spring.data.cosmos.repository.TestRepositoryConfig; +import com.azure.spring.data.cosmos.repository.repository.ProjectRepository; +import com.azure.spring.data.cosmos.repository.repository.QuestionRepository; import org.assertj.core.util.Lists; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.*; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/ReactiveCourseRepositoryIT.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/ReactiveCourseRepositoryIT.java similarity index 94% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/ReactiveCourseRepositoryIT.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/ReactiveCourseRepositoryIT.java index 140cff164df8..df2780cfc216 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/ReactiveCourseRepositoryIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/ReactiveCourseRepositoryIT.java @@ -1,14 +1,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.integration; +package com.azure.spring.data.cosmos.repository.integration; import com.azure.data.cosmos.PartitionKey; -import com.microsoft.azure.spring.data.cosmosdb.core.ReactiveCosmosTemplate; -import com.microsoft.azure.spring.data.cosmosdb.domain.Course; -import com.microsoft.azure.spring.data.cosmosdb.exception.CosmosDBAccessException; -import com.microsoft.azure.spring.data.cosmosdb.repository.TestRepositoryConfig; -import com.microsoft.azure.spring.data.cosmosdb.repository.repository.ReactiveCourseRepository; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.core.ReactiveCosmosTemplate; +import com.azure.spring.data.cosmos.exception.CosmosDBAccessException; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.domain.Course; +import com.azure.spring.data.cosmos.repository.TestRepositoryConfig; +import com.azure.spring.data.cosmos.repository.repository.ReactiveCourseRepository; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/SpELCosmosDBAnnotationIT.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/SpELCosmosDBAnnotationIT.java similarity index 81% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/SpELCosmosDBAnnotationIT.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/SpELCosmosDBAnnotationIT.java index ab8965c8b67d..608e26b6b60b 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/SpELCosmosDBAnnotationIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/SpELCosmosDBAnnotationIT.java @@ -1,19 +1,19 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.integration; - +package com.azure.spring.data.cosmos.repository.integration; + +import com.azure.spring.data.cosmos.CosmosDbFactory; +import com.azure.spring.data.cosmos.config.CosmosDBConfig; +import com.azure.spring.data.cosmos.core.CosmosTemplate; +import com.azure.spring.data.cosmos.core.convert.MappingCosmosConverter; +import com.azure.spring.data.cosmos.core.convert.ObjectMapperFactory; +import com.azure.spring.data.cosmos.core.mapping.CosmosMappingContext; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; import com.fasterxml.jackson.databind.ObjectMapper; -import com.microsoft.azure.spring.data.cosmosdb.CosmosDbFactory; -import com.microsoft.azure.spring.data.cosmosdb.common.TestConstants; -import com.microsoft.azure.spring.data.cosmosdb.config.CosmosDBConfig; -import com.microsoft.azure.spring.data.cosmosdb.core.CosmosTemplate; -import com.microsoft.azure.spring.data.cosmosdb.core.convert.MappingCosmosConverter; -import com.microsoft.azure.spring.data.cosmosdb.core.convert.ObjectMapperFactory; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.CosmosMappingContext; -import com.microsoft.azure.spring.data.cosmosdb.domain.SpELBeanStudent; -import com.microsoft.azure.spring.data.cosmosdb.domain.SpELPropertyStudent; -import com.microsoft.azure.spring.data.cosmosdb.repository.TestRepositoryConfig; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.common.TestConstants; +import com.azure.spring.data.cosmos.domain.SpELBeanStudent; +import com.azure.spring.data.cosmos.domain.SpELPropertyStudent; +import com.azure.spring.data.cosmos.repository.TestRepositoryConfig; import org.junit.AfterClass; import org.junit.Before; import org.junit.Test; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/SquareRepositoryIT.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/SquareRepositoryIT.java similarity index 80% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/SquareRepositoryIT.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/SquareRepositoryIT.java index b186197af719..f7a0bbbc9a5c 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/SquareRepositoryIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/SquareRepositoryIT.java @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.integration; +package com.azure.spring.data.cosmos.repository.integration; -import com.microsoft.azure.spring.data.cosmosdb.common.TestUtils; -import com.microsoft.azure.spring.data.cosmosdb.core.CosmosTemplate; -import com.microsoft.azure.spring.data.cosmosdb.domain.inheritance.Square; -import com.microsoft.azure.spring.data.cosmosdb.repository.TestRepositoryConfig; -import com.microsoft.azure.spring.data.cosmosdb.repository.repository.SquareRepository; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.core.CosmosTemplate; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.common.TestUtils; +import com.azure.spring.data.cosmos.domain.inheritance.Square; +import com.azure.spring.data.cosmos.repository.TestRepositoryConfig; +import com.azure.spring.data.cosmos.repository.repository.SquareRepository; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/StudentRepositoryIT.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/StudentRepositoryIT.java similarity index 90% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/StudentRepositoryIT.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/StudentRepositoryIT.java index 9b0058e7f905..5da443d21f66 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/integration/StudentRepositoryIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/StudentRepositoryIT.java @@ -1,17 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.integration; - -import com.microsoft.azure.spring.data.cosmosdb.core.CosmosTemplate; -import com.microsoft.azure.spring.data.cosmosdb.domain.Student; -import com.microsoft.azure.spring.data.cosmosdb.repository.TestRepositoryConfig; -import com.microsoft.azure.spring.data.cosmosdb.repository.repository.StudentRepository; -import com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosEntityInformation; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +package com.azure.spring.data.cosmos.repository.integration; + +import com.azure.spring.data.cosmos.core.CosmosTemplate; +import com.azure.spring.data.cosmos.repository.support.CosmosEntityInformation; +import com.azure.spring.data.cosmos.domain.Student; +import com.azure.spring.data.cosmos.repository.TestRepositoryConfig; +import com.azure.spring.data.cosmos.repository.repository.StudentRepository; +import org.junit.*; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/AddressRepository.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/AddressRepository.java similarity index 74% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/AddressRepository.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/AddressRepository.java index 1f7a6055df0e..69cb5ee06e9e 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/AddressRepository.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/AddressRepository.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.repository; +package com.azure.spring.data.cosmos.repository.repository; -import com.microsoft.azure.spring.data.cosmosdb.domain.Address; -import com.microsoft.azure.spring.data.cosmosdb.repository.CosmosRepository; +import com.azure.spring.data.cosmos.repository.CosmosRepository; +import com.azure.spring.data.cosmos.domain.Address; import org.springframework.stereotype.Repository; import java.util.List; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/ContactRepository.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/ContactRepository.java similarity index 59% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/ContactRepository.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/ContactRepository.java index 3d52e998547b..e13047d28442 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/ContactRepository.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/ContactRepository.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.repository; +package com.azure.spring.data.cosmos.repository.repository; -import com.microsoft.azure.spring.data.cosmosdb.domain.Contact; -import com.microsoft.azure.spring.data.cosmosdb.repository.CosmosRepository; +import com.azure.spring.data.cosmos.repository.CosmosRepository; +import com.azure.spring.data.cosmos.domain.Contact; import org.springframework.stereotype.Repository; import java.util.List; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/CustomerRepository.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/CustomerRepository.java similarity index 54% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/CustomerRepository.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/CustomerRepository.java index 9c1a0e5d33e4..6a15bd90b4fa 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/CustomerRepository.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/CustomerRepository.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.repository; +package com.azure.spring.data.cosmos.repository.repository; -import com.microsoft.azure.spring.data.cosmosdb.domain.Customer; -import com.microsoft.azure.spring.data.cosmosdb.repository.CosmosRepository; +import com.azure.spring.data.cosmos.repository.CosmosRepository; +import com.azure.spring.data.cosmos.domain.Customer; import java.util.List; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/IntegerIdDomainRepository.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/IntegerIdDomainRepository.java similarity index 53% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/IntegerIdDomainRepository.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/IntegerIdDomainRepository.java index 5c7cb1b9a575..295d7f3d7c66 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/IntegerIdDomainRepository.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/IntegerIdDomainRepository.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.repository; +package com.azure.spring.data.cosmos.repository.repository; -import com.microsoft.azure.spring.data.cosmosdb.domain.IntegerIdDomain; -import com.microsoft.azure.spring.data.cosmosdb.repository.CosmosRepository; +import com.azure.spring.data.cosmos.repository.CosmosRepository; +import com.azure.spring.data.cosmos.domain.IntegerIdDomain; import org.springframework.stereotype.Repository; @Repository diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/MemoRepository.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/MemoRepository.java similarity index 79% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/MemoRepository.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/MemoRepository.java index f6544d0462c4..56f51bef2f60 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/MemoRepository.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/MemoRepository.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.repository; +package com.azure.spring.data.cosmos.repository.repository; -import com.microsoft.azure.spring.data.cosmosdb.domain.Memo; -import com.microsoft.azure.spring.data.cosmosdb.domain.Importance; -import com.microsoft.azure.spring.data.cosmosdb.repository.CosmosRepository; +import com.azure.spring.data.cosmos.repository.CosmosRepository; +import com.azure.spring.data.cosmos.domain.Importance; +import com.azure.spring.data.cosmos.domain.Memo; import org.springframework.stereotype.Repository; import java.util.Date; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/PageableAddressRepository.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/PageableAddressRepository.java similarity index 80% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/PageableAddressRepository.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/PageableAddressRepository.java index 76d794a6eda1..94adbb0e53a6 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/PageableAddressRepository.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/PageableAddressRepository.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.repository; +package com.azure.spring.data.cosmos.repository.repository; -import com.microsoft.azure.spring.data.cosmosdb.domain.PageableAddress; +import com.azure.spring.data.cosmos.domain.PageableAddress; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.repository.PagingAndSortingRepository; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/PageableMemoRepository.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/PageableMemoRepository.java similarity index 70% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/PageableMemoRepository.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/PageableMemoRepository.java index 7630c84672d2..f6b138b9df55 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/PageableMemoRepository.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/PageableMemoRepository.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.repository; +package com.azure.spring.data.cosmos.repository.repository; -import com.microsoft.azure.spring.data.cosmosdb.domain.PageableMemo; +import com.azure.spring.data.cosmos.domain.PageableMemo; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.stereotype.Repository; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/PageablePersonRepository.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/PageablePersonRepository.java similarity index 70% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/PageablePersonRepository.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/PageablePersonRepository.java index afc831158210..74d495199ea8 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/PageablePersonRepository.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/PageablePersonRepository.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.repository; +package com.azure.spring.data.cosmos.repository.repository; -import com.microsoft.azure.spring.data.cosmosdb.domain.PageablePerson; +import com.azure.spring.data.cosmos.domain.PageablePerson; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.stereotype.Repository; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/PartitionPersonRepository.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/PartitionPersonRepository.java similarity index 53% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/PartitionPersonRepository.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/PartitionPersonRepository.java index f88f6eb54b79..df1a33f88ae1 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/PartitionPersonRepository.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/PartitionPersonRepository.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.repository; +package com.azure.spring.data.cosmos.repository.repository; -import com.microsoft.azure.spring.data.cosmosdb.domain.PartitionPerson; -import com.microsoft.azure.spring.data.cosmosdb.repository.CosmosRepository; +import com.azure.spring.data.cosmos.repository.CosmosRepository; +import com.azure.spring.data.cosmos.domain.PartitionPerson; import org.springframework.stereotype.Repository; @Repository diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/PersonRepository.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/PersonRepository.java similarity index 52% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/PersonRepository.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/PersonRepository.java index 95cbe3ecc681..11c63be3e4af 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/PersonRepository.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/PersonRepository.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.repository; +package com.azure.spring.data.cosmos.repository.repository; -import com.microsoft.azure.spring.data.cosmosdb.domain.Person; -import com.microsoft.azure.spring.data.cosmosdb.repository.CosmosRepository; +import com.azure.spring.data.cosmos.repository.CosmosRepository; +import com.azure.spring.data.cosmos.domain.Person; import org.springframework.stereotype.Repository; @Repository diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/ProjectRepository.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/ProjectRepository.java similarity index 93% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/ProjectRepository.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/ProjectRepository.java index a8b0049754df..c930ca9d8486 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/ProjectRepository.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/ProjectRepository.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.repository; +package com.azure.spring.data.cosmos.repository.repository; -import com.microsoft.azure.spring.data.cosmosdb.domain.Project; -import com.microsoft.azure.spring.data.cosmosdb.repository.CosmosRepository; +import com.azure.spring.data.cosmos.repository.CosmosRepository; +import com.azure.spring.data.cosmos.domain.Project; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; diff --git a/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/QuestionRepository.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/QuestionRepository.java new file mode 100644 index 000000000000..0d043875c128 --- /dev/null +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/QuestionRepository.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.spring.data.cosmos.repository.repository; + +import com.azure.spring.data.cosmos.repository.CosmosRepository; +import com.azure.spring.data.cosmos.domain.Question; + +public interface QuestionRepository extends CosmosRepository { +} diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/ReactiveCourseRepository.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/ReactiveCourseRepository.java similarity index 59% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/ReactiveCourseRepository.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/ReactiveCourseRepository.java index 6ad3a66ea4b4..50f589f4b31e 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/ReactiveCourseRepository.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/ReactiveCourseRepository.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.repository; +package com.azure.spring.data.cosmos.repository.repository; -import com.microsoft.azure.spring.data.cosmosdb.domain.Course; -import com.microsoft.azure.spring.data.cosmosdb.repository.ReactiveCosmosRepository; +import com.azure.spring.data.cosmos.repository.ReactiveCosmosRepository; +import com.azure.spring.data.cosmos.domain.Course; import reactor.core.publisher.Flux; import java.util.Collection; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/SortedProjectRepository.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/SortedProjectRepository.java similarity index 75% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/SortedProjectRepository.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/SortedProjectRepository.java index b6606d8fe59b..e841aaab8d2c 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/SortedProjectRepository.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/SortedProjectRepository.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.repository; +package com.azure.spring.data.cosmos.repository.repository; -import com.microsoft.azure.spring.data.cosmosdb.domain.SortedProject; -import com.microsoft.azure.spring.data.cosmosdb.repository.CosmosRepository; +import com.azure.spring.data.cosmos.repository.CosmosRepository; +import com.azure.spring.data.cosmos.domain.SortedProject; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/SquareRepository.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/SquareRepository.java similarity index 51% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/SquareRepository.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/SquareRepository.java index 295f881e24a6..0026cc7b8ad1 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/SquareRepository.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/SquareRepository.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.repository; +package com.azure.spring.data.cosmos.repository.repository; -import com.microsoft.azure.spring.data.cosmosdb.domain.inheritance.Square; -import com.microsoft.azure.spring.data.cosmosdb.repository.CosmosRepository; +import com.azure.spring.data.cosmos.repository.CosmosRepository; +import com.azure.spring.data.cosmos.domain.inheritance.Square; import org.springframework.stereotype.Repository; @Repository diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/StudentRepository.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/StudentRepository.java similarity index 83% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/StudentRepository.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/StudentRepository.java index 4428770df373..f8039bc21388 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/StudentRepository.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/StudentRepository.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.repository; +package com.azure.spring.data.cosmos.repository.repository; -import com.microsoft.azure.spring.data.cosmosdb.domain.Student; -import com.microsoft.azure.spring.data.cosmosdb.repository.CosmosRepository; +import com.azure.spring.data.cosmos.repository.CosmosRepository; +import com.azure.spring.data.cosmos.domain.Student; import org.springframework.stereotype.Repository; import java.util.List; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/CosmosEntityInformationUnitTest.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/support/CosmosEntityInformationUnitTest.java similarity index 95% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/CosmosEntityInformationUnitTest.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/support/CosmosEntityInformationUnitTest.java index 598f0359d8c7..3a5ecd362fe3 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/CosmosEntityInformationUnitTest.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/support/CosmosEntityInformationUnitTest.java @@ -1,20 +1,19 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.support; +package com.azure.spring.data.cosmos.repository.support; + +import com.azure.spring.data.cosmos.core.mapping.Document; +import com.azure.spring.data.cosmos.core.mapping.PartitionKey; +import com.azure.spring.data.cosmos.common.TestConstants; +import com.azure.spring.data.cosmos.domain.Address; +import com.azure.spring.data.cosmos.domain.Person; +import com.azure.spring.data.cosmos.domain.Student; +import org.junit.Test; +import org.springframework.data.annotation.Version; import java.util.List; import java.util.Objects; -import com.microsoft.azure.spring.data.cosmosdb.common.TestConstants; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.Document; -import com.microsoft.azure.spring.data.cosmosdb.core.mapping.PartitionKey; -import com.microsoft.azure.spring.data.cosmosdb.domain.Address; -import com.microsoft.azure.spring.data.cosmosdb.domain.Person; -import com.microsoft.azure.spring.data.cosmosdb.domain.Student; -import org.junit.Test; - -import org.springframework.data.annotation.Version; - import static org.assertj.core.api.Assertions.assertThat; public class CosmosEntityInformationUnitTest { diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/CosmosRepositoryFactoryBeanUnitTest.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/support/CosmosRepositoryFactoryBeanUnitTest.java similarity index 79% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/CosmosRepositoryFactoryBeanUnitTest.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/support/CosmosRepositoryFactoryBeanUnitTest.java index e6bbdcaf5787..cb205d625cc9 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/CosmosRepositoryFactoryBeanUnitTest.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/support/CosmosRepositoryFactoryBeanUnitTest.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.support; +package com.azure.spring.data.cosmos.repository.support; -import com.microsoft.azure.spring.data.cosmosdb.core.CosmosTemplate; -import com.microsoft.azure.spring.data.cosmosdb.repository.repository.PersonRepository; +import com.azure.spring.data.cosmos.core.CosmosTemplate; +import com.azure.spring.data.cosmos.repository.repository.PersonRepository; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/CosmosRepositoryFactoryUnitTest.java b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/support/CosmosRepositoryFactoryUnitTest.java similarity index 83% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/CosmosRepositoryFactoryUnitTest.java rename to sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/support/CosmosRepositoryFactoryUnitTest.java index b9252c4ca758..086c9cdb29f7 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/support/CosmosRepositoryFactoryUnitTest.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/support/CosmosRepositoryFactoryUnitTest.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.support; +package com.azure.spring.data.cosmos.repository.support; -import com.microsoft.azure.spring.data.cosmosdb.core.CosmosTemplate; -import com.microsoft.azure.spring.data.cosmosdb.domain.Person; +import com.azure.spring.data.cosmos.core.CosmosTemplate; +import com.azure.spring.data.cosmos.domain.Person; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/resources/application.properties b/sdk/cosmos/azure-spring-data-cosmos/src/test/resources/application.properties similarity index 76% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/resources/application.properties rename to sdk/cosmos/azure-spring-data-cosmos/src/test/resources/application.properties index 85ff3ddb4a40..12b7c8f46f80 100644 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/resources/application.properties +++ b/sdk/cosmos/azure-spring-data-cosmos/src/test/resources/application.properties @@ -1,6 +1,6 @@ -cosmosdb.uri=${DOCUMENTDB_URI} -cosmosdb.key=${DOCUMENTDB_KEY} -cosmosdb.secondaryKey=${COSMOSDB_SECONDARY_KEY} +cosmosdb.uri=${ACCOUNT_HOST} +cosmosdb.key=${ACCOUNT_KEY} +cosmosdb.secondaryKey=${SECONDARY_ACCOUNT_KEY} #You can also use connection string instead of uri and key to connect to cosmos DB #cosmosdb.connection-string=${DOCUMENTDB_CONNECTION_STRING} diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/resources/application.yml b/sdk/cosmos/azure-spring-data-cosmos/src/test/resources/application.yml similarity index 100% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/resources/application.yml rename to sdk/cosmos/azure-spring-data-cosmos/src/test/resources/application.yml diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/resources/logback-test.xml b/sdk/cosmos/azure-spring-data-cosmos/src/test/resources/logback-test.xml similarity index 100% rename from sdk/cosmos/azure-spring-data-cosmosdb/src/test/resources/logback-test.xml rename to sdk/cosmos/azure-spring-data-cosmos/src/test/resources/logback-test.xml diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/CHANGELOG.md b/sdk/cosmos/azure-spring-data-cosmosdb/CHANGELOG.md deleted file mode 100644 index d98c3d0f2282..000000000000 --- a/sdk/cosmos/azure-spring-data-cosmosdb/CHANGELOG.md +++ /dev/null @@ -1,3 +0,0 @@ -# Release History - -## 2.3.1-beta.1 (Unreleased) diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/README.md b/sdk/cosmos/azure-spring-data-cosmosdb/README.md deleted file mode 100644 index c181d5b5ff53..000000000000 --- a/sdk/cosmos/azure-spring-data-cosmosdb/README.md +++ /dev/null @@ -1,342 +0,0 @@ -[![Travis CI](https://travis-ci.org/Microsoft/spring-data-cosmosdb.svg?branch=master)](https://travis-ci.org/Microsoft/spring-data-cosmosdb) -[![codecov](https://codecov.io/gh/Microsoft/spring-data-cosmosdb/branch/master/graph/badge.svg)](https://codecov.io/gh/Microsoft/spring-data-cosmosdb) -[![MIT License](http://img.shields.io/badge/license-MIT-green.svg) ](https://github.com/Microsoft/spring-data-cosmosdb/blob/master/LICENSE) - - -#Azure Cosmos DB client library for Java - -## Getting started -[Azure Cosmos DB](https://docs.microsoft.com/en-us/azure/cosmos-db/introduction) is a globally-distributed database service that allows developers to work with data using a variety of standard APIs, such as SQL, MongoDB, Cassandra, Graph, and Table. - -**Spring Data Azure Cosmos DB** provides initial Spring Data support for Azure Cosmos DB using the [SQL API](https://docs.microsoft.com/en-us/azure/cosmos-db/sql-api-introduction), based on Spring Data framework. Currently it only supports SQL API, the other APIs are in the plan. - -## TOC - -* [Examples](#Examples) -* [Spring data version support](#spring-data-version-support) -* [Feature List](#feature-list) -* [Quick Start](#quick-start) -* [Query Partitioned Collection](QueryPartitionedCollection.md) -* [Snapshots](#snapshots) -* [Troubleshooting](#Troubleshooting) -* [Contributing](#Contributing) -* [Code of Conduct](#code-of-conduct) -* [Key concepts](#Key concepts) -* [Next steps](#Next steps) - -## Examples -Please refer to [sample project here](./samplecode). - -## Spring Data Version Support -Version mapping between spring boot and spring-data-cosmosdb: - -| Spring boot version | spring-data-cosmosdb version | -| :----------------------------------------------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| -| ![version](https://img.shields.io/badge/version-2.3.x-blue) | [![Maven Central](https://img.shields.io/maven-central/v/com.microsoft.azure/spring-data-cosmosdb/2.3.svg)](https://search.maven.org/search?q=g:com.microsoft.azure%20AND%20a:spring-data-cosmosdb%20AND%20v:2.3.*) | -| ![version](https://img.shields.io/badge/version-2.2.x-blue) | [![Maven Central](https://img.shields.io/maven-central/v/com.microsoft.azure/spring-data-cosmosdb/2.2.svg)](https://search.maven.org/search?q=g:com.microsoft.azure%20AND%20a:spring-data-cosmosdb%20AND%20v:2.2.*) | -| ![version](https://img.shields.io/badge/version-2.1.x-blue) | [![Maven Central](https://img.shields.io/maven-central/v/com.microsoft.azure/spring-data-cosmosdb/2.1.svg)](https://search.maven.org/search?q=g:com.microsoft.azure%20AND%20a:spring-data-cosmosdb%20AND%20v:2.1.*) | -| ![version](https://img.shields.io/badge/version-2.0.x-blue) | [![Maven Central](https://img.shields.io/maven-central/v/com.microsoft.azure/spring-data-cosmosdb/2.0.svg)](https://search.maven.org/search?q=g:com.microsoft.azure%20AND%20a:spring-data-cosmosdb%20AND%20v:2.0.*) | - -## Feature List -- Spring Data ReactiveCrudRepository CrudRepository basic CRUD functionality - - save - - findAll - - findOne by Id - - deleteAll - - delete by Id - - delete entity -- Spring Data [@Id](https://github.com/spring-projects/spring-data-commons/blob/db62390de90c93a78743c97cc2cc9ccd964994a5/src/main/java/org/springframework/data/annotation/Id.java) annotation. - There're 2 ways to map a field in domain class to `id` field of Azure Cosmos DB document. - - annotate a field in domain class with `@Id`, this field will be mapped to document `id` in Cosmos DB. - - set name of this field to `id`, this field will be mapped to document `id` in Azure Cosmos DB. -- Custom collection Name. - By default, collection name will be class name of user domain class. To customize it, add the `@Document(collection="myCustomCollectionName")` annotation to the domain class. The collection field also supports SpEL expressions (eg. `collection = "${dynamic.collection.name}"` or `collection = "#{@someBean.getContainerName()}"`) in order to provide collection names programmatically/via configuration properties. -- Custom IndexingPolicy - By default, IndexingPolicy will be set by azure service. To customize it add annotation `@DocumentIndexingPolicy` to domain class. This annotation has 4 attributes to customize, see following: -```java - boolean automatic; // Indicate if indexing policy use automatic or not - IndexingMode mode; // Indexing policy mode, option Consistent|Lazy|None. - String[] includePaths; // Included paths for indexing - String[] excludePaths; // Excluded paths for indexing -``` -- Supports Optimistic Locking for specific collections, which means upserts/deletes by document will fail with an exception in case the document was modified by another process in the meanwhile. To enable Optimistic Locking for a collection, just create a string `_etag` field and mark it with the `@Version` annotation. See the following: - -```java -@Document(collection = "myCollection") -class MyDocument { - String id; - String data; - @Version - String _etag; -} -``` -- Supports [Azure Cosmos DB partition](https://docs.microsoft.com/en-us/azure/cosmos-db/partition-data). To specify a field of domain class to be partition key field, just annotate it with `@PartitionKey`. When you do CRUD operation, pls specify your partition value. For more sample on partition CRUD, pls refer to [test here](./src/test/java/com/microsoft/azure/spring/data/cosmosdb/repository/integration/AddressRepositoryIT.java) -- Supports [Spring Data custom query](https://docs.spring.io/spring-data/commons/docs/current/reference/html/#repositories.query-methods.details) find operation, e.g., `findByAFieldAndBField` -- Supports [Spring Data pagable and sort](https://docs.spring.io/spring-data/commons/docs/current/reference/html/#repositories.special-parameters). - - Based on available RUs on the database account, cosmosDB can return documents less than or equal to the requested size. - - Due to this variable number of returned documents in every iteration, user should not rely on the totalPageSize, and instead iterating over pageable should be done in this way. -```java - final CosmosPageRequest pageRequest = new CosmosPageRequest(0, pageSize, null); - Page page = tRepository.findAll(pageRequest); - List pageContent = page.getContent(); - while(page.hasNext()) { - Pageable nextPageable = page.nextPageable(); - page = repository.findAll(nextPageable); - pageContent = page.getContent(); - } -``` -- Supports [spring-boot-starter-data-rest](https://projects.spring.io/spring-data-rest/). -- Supports List and nested type in domain class. -- Configurable ObjectMapper bean with unique name `cosmosdbObjectMapper`, only configure customized ObjectMapper if you really need to. e.g., -```java - @Bean(name = "cosmosdbObjectMapper") - public ObjectMapper objectMapper() { - return new ObjectMapper(); // Do configuration to the ObjectMapper if required - } -``` - -## Quick Start - -### Add the dependency -`spring-data-cosmosdb` is published on Maven Central Repository. -If you are using Maven, add the following dependency. - -```xml - - com.microsoft.azure - spring-data-cosmosdb - 2.2.4 - -``` - -### Setup Configuration -Setup configuration class. - -CosmosKeyCredential feature provides capability to rotate keys on the fly. You can switch keys using switchToSecondaryKey(). -For more information on this, see the Sample Application code. - -### Sync and Reactive Repository support -2.2.x supports both sync and reactive repository support. - -Use `@EnableCosmosRepositories` to enable sync repository support. - -For reactive repository support, use `@EnableReactiveCosmosRepositories` - -### Response Diagnostics String and Query Metrics -2.2.x supports Response Diagnostics String and Query Metrics. -Set `populateQueryMetrics` flag to true in application.properties to enable query metrics. -In addition to setting the flag, implement `ResponseDiagnosticsProcessor` to log diagnostics information. - -```java -@Configuration -@EnableCosmosRepositories -@Slf4j -public class AppConfiguration extends AbstractCosmosConfiguration { - - @Value("${azure.cosmosdb.uri}") - private String uri; - - @Value("${azure.cosmosdb.key}") - private String key; - - @Value("${azure.cosmosdb.secondaryKey}") - private String secondaryKey; - - @Value("${azure.cosmosdb.database}") - private String dbName; - - @Value("${azure.cosmosdb.populateQueryMetrics}") - private boolean populateQueryMetrics; - - private CosmosKeyCredential cosmosKeyCredential; - - public CosmosDBConfig getConfig() { - this.cosmosKeyCredential = new CosmosKeyCredential(key); - CosmosDbConfig cosmosdbConfig = CosmosDBConfig.builder(uri, - this.cosmosKeyCredential, dbName).build(); - cosmosdbConfig.setPopulateQueryMetrics(populateQueryMetrics); - cosmosdbConfig.setResponseDiagnosticsProcessor(new ResponseDiagnosticsProcessorImplementation()); - return cosmosdbConfig; - } - - public void switchToSecondaryKey() { - this.cosmosKeyCredential.key(secondaryKey); - } - - private static class ResponseDiagnosticsProcessorImplementation implements ResponseDiagnosticsProcessor { - - @Override - public void processResponseDiagnostics(@Nullable ResponseDiagnostics responseDiagnostics) { - log.info("Response Diagnostics {}", responseDiagnostics); - } - } - -} -``` -Or if you want to customize your config: -```java -public CosmosDBConfig getConfig() { - this.cosmosKeyCredential = new CosmosKeyCredential(key); - CosmosDBConfig cosmosDbConfig = CosmosDBConfig.builder(uri, this.cosmosKeyCredential, dbName).build(); - cosmosDbConfig.getConnectionPolicy().setConnectionMode(ConnectionMode.DIRECT); - cosmosDbConfig.getConnectionPolicy().setMaxPoolSize(1000); - return cosmosDbConfig; -} -``` -By default, `@EnableCosmosRepositories` will scan the current package for any interfaces that extend one of Spring Data's repository interfaces. Using it to annotate your Configuration class to scan a different root package by type if your project layout has multiple projects and it's not finding your repositories. -```java -@Configuration -@EnableCosmosRepositories(basePackageClass=UserRepository.class) -public class AppConfiguration extends AbstractCosmosConfiguration { - // configuration code -} -``` - - -### Define an entity -Define a simple entity as Document in Azure Cosmos DB. - -You can define entities by adding the `@Document` annotation and specifying properties related to the container, such as the container name, request units (RUs), time to live, and auto-create container. - -Containers are created automatically unless you don't want them to: Set `autoCreateCollection` to false in `@Document` annotation to disable auto creation of containers. - -Note: By default request units assigned to newly created containers is 4000. Specify different ru value to customize request units for container created by the SDK (minimum RU value is 400). - -```java -@Document(collection = "myCollection", ru = "400") -public class User { - private String id; - private String firstName; - - @PartitionKey - private String lastName; - - ... // setters and getters - - public User() { - // If you do not want to create a default constructor, - // use annotation @JsonCreator and @JsonProperty in the full args constructor - } - - public User(String id, String firstName, String lastName) { - this.id = id; - this.firstName = firstName; - this.lastName = lastName; - } - - @Override - public String toString() { - return String.format("User: %s %s, %s", firstName, lastName, id); - } -} -``` -`id` field will be used as document id in Azure Cosmos DB. If you want use another field like `emailAddress` as document `id`, just annotate that field with `@Id` annotation. - -Annotation `@Document(collection="mycollection")` is used to specify collection name in Azure Cosmos DB. -Annotation `@PartitionKey` on `lastName` field is used to specify this field be partition key in Azure Cosmos DB. - -```java -@Document(collection = "mycollection") -public class User { - @Id - private String emailAddress; - - ... -} -``` - -### Create repositories -Extends CosmosRepository interface, which provides Spring Data repository support. - -```java -import CosmosRepository; -import org.springframework.stereotype.Repository; - -@Repository -public interface UserRepository extends CosmosRepository { - List findByFirstName(String firstName); -} -``` - -`findByFirstName` method is custom query method, it will find documents per FirstName. - -### Create an Application class -Here create an application class with all the components - -```java -@SpringBootApplication -public class SampleApplication implements CommandLineRunner { - - @Autowired - private UserRepository repository; - - @Autowired - private ApplicationContext applicationContext; - - public static void main(String[] args) { - SpringApplication.run(SampleApplication.class, args); - } - - public void run(String... var1) throws Exception { - - final User testUser = new User("testId", "testFirstName", "testLastName"); - - repository.deleteAll(); - repository.save(testUser); - - // to find by Id, please specify partition key value if collection is partitioned - final User result = repository.findOne(testUser.getId(), testUser.getLastName); - // if emailAddress is mapped to id, then - // final User result = respository.findOne(testUser.getEmailAddress(), testUser.getLastName()); - - // Switch to secondary key - UserRepositoryConfiguration bean = - applicationContext.getBean(UserRepositoryConfiguration.class); - bean.switchToSecondaryKey(); - - // Now repository will use secondary key - repository.save(testUser); - - } -} -``` -Autowired UserRepository interface, then can do save, delete and find operations. Spring Data Azure Cosmos DB uses the CosmosTemplate to execute the queries behind *find*, *save* methods. You can use the template yourself for more complex queries. - -## Snapshots -[![Nexus OSS](https://img.shields.io/nexus/snapshots/https/oss.sonatype.org/com.microsoft.azure/spring-data-cosmosdb.svg)](https://oss.sonatype.org/content/repositories/snapshots/com/microsoft/azure/spring-data-cosmosdb/) - -Snapshots built from `master` branch are available, add [maven repositories](https://maven.apache.org/settings.html#Repositories) configuration to your pom file as below. -```xml - - - nexus-snapshots - https://oss.sonatype.org/content/repositories/snapshots/ - - true - always - - - -``` - -## Troubleshooting - -If you encounter any bug, please file an issue [here](https://github.com/Microsoft/spring-data-cosmosdb/issues/new). - -To suggest a new feature or changes that could be made, file an issue the same way you would for a bug. - -## Contributing - -Contribution is welcome. Please follow [this instruction](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md) to contribute code. - -## Code of Conduct - -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. - -### Data/Telemetry - - This project collects usage data and sends it to Microsoft to help improve our products and services. Read our [privacy](https://privacy.microsoft.com/en-us/privacystatement) statement to learn more. - -## Key concepts - -## Next steps diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/resources/META-INF/spring.factories b/sdk/cosmos/azure-spring-data-cosmosdb/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 1884afe05dff..000000000000 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1 +0,0 @@ -org.springframework.data.repository.core.support.RepositoryFactorySupport=com.microsoft.azure.spring.data.cosmosdb.repository.support.CosmosRepositoryFactory \ No newline at end of file diff --git a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/QuestionRepository.java b/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/QuestionRepository.java deleted file mode 100644 index 0e27bd1381e0..000000000000 --- a/sdk/cosmos/azure-spring-data-cosmosdb/src/test/java/com.microsoft.azure.spring.data.cosmosdb/repository/repository/QuestionRepository.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.microsoft.azure.spring.data.cosmosdb.repository.repository; - -import com.microsoft.azure.spring.data.cosmosdb.domain.Question; -import com.microsoft.azure.spring.data.cosmosdb.repository.CosmosRepository; - -public interface QuestionRepository extends CosmosRepository { -} diff --git a/sdk/cosmos/ci.yml b/sdk/cosmos/ci.yml index 5fda6a2dcdf8..4b65101fddcd 100644 --- a/sdk/cosmos/ci.yml +++ b/sdk/cosmos/ci.yml @@ -43,9 +43,9 @@ extends: - name: azure-cosmos groupId: com.azure safeName: azurecosmos - - name: spring-data-cosmosdb - groupId: com.microsoft.azure - safeName: springdatacosmosdb + - name: azure-spring-data-cosmos + groupId: com.azure + safeName: azurespringdatacosmos AdditionalModules: - name: azure-cosmos-benchmark groupId: com.azure diff --git a/sdk/cosmos/mgmt/src/main/java/com/azure/resourcemanager/cosmos/CosmosDBManagementClient.java b/sdk/cosmos/mgmt/src/main/java/com/azure/resourcemanager/cosmos/CosmosDBManagementClient.java index ec633089b941..32bdc2f406e2 100644 --- a/sdk/cosmos/mgmt/src/main/java/com/azure/resourcemanager/cosmos/CosmosDBManagementClient.java +++ b/sdk/cosmos/mgmt/src/main/java/com/azure/resourcemanager/cosmos/CosmosDBManagementClient.java @@ -8,7 +8,7 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.management.AzureEnvironment; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.AzureServiceClient; +import com.azure.resourcemanager.resources.fluentcore.AzureServiceClient; import com.azure.resourcemanager.cosmos.fluent.CassandraResourcesClient; import com.azure.resourcemanager.cosmos.fluent.CollectionPartitionRegionsClient; import com.azure.resourcemanager.cosmos.fluent.CollectionPartitionsClient; diff --git a/sdk/cosmos/pom.xml b/sdk/cosmos/pom.xml index 3ef7f2e8daa9..025f5523dfa2 100644 --- a/sdk/cosmos/pom.xml +++ b/sdk/cosmos/pom.xml @@ -11,7 +11,7 @@ azure-cosmos azure-cosmos-benchmark - azure-spring-data-cosmosdb + azure-spring-data-cosmos diff --git a/sdk/cosmos/test-resources.json b/sdk/cosmos/test-resources.json index 5ff266717f1b..447dd5729a44 100644 --- a/sdk/cosmos/test-resources.json +++ b/sdk/cosmos/test-resources.json @@ -95,4 +95,4 @@ "value": "[listKeys(variables('resourceId'), variables('apiVersion')).secondaryMasterKey]" } } -} \ No newline at end of file +} diff --git a/sdk/cosmos/tests.yml b/sdk/cosmos/tests.yml index ecddcf4d81e7..ceb95d3e8df6 100644 --- a/sdk/cosmos/tests.yml +++ b/sdk/cosmos/tests.yml @@ -244,4 +244,33 @@ jobs: goals: verify options: '$(ProfileFlag) -Dgpg.skip $(AdditionalArgs) -pl $(ProjectList)' - TestResultsFiles: '**/junitreports/TEST-*.xml' \ No newline at end of file + TestResultsFiles: '**/junitreports/TEST-*.xml' + + - template: ../../eng/pipelines/templates/jobs/archetype-sdk-tests.yml + parameters: + TestName: Integration_Test_Spring_Data_Cosmosdb + ServiceDirectory: cosmos + Artifacts: + - name: azure-spring-data-cosmos + groupId: com.azure + safeName: azurespringdatacosmos + TimeoutInMinutes: 90 + Matrix: + Session_Integration: + ArmTemplateParameters: "@{ enableMultipleWriteLocations = $false; defaultConsistencyLevel = 'Session' }" + DisplayName: Session Integration + OSVmImage: 'ubuntu-18.04' + ProfileFlag: '-P integration-test-azure' + Strong_Integration: + ArmTemplateParameters: "@{ enableMultipleWriteLocations = $false; defaultConsistencyLevel = 'Strong' }" + DisplayName: Strong Integration + OSVmImage: 'ubuntu-18.04' + ProfileFlag: '-P integration-test-azure' + + EnvVars: + AZURE_TEST_MODE: LIVE + PreRunSteps: + - template: /eng/pipelines/templates/steps/install-reporting-tools.yml + TestStepMavenInputs: + goals: verify + options: '$(ProfileFlag) -Dgpg.skip -Dmaven.wagon.http.pool=false $(DefaultOptions) -Dmaven.javadoc.skip=true -Drevapi.skip=true -pl $(ProjectList)' diff --git a/sdk/dns/mgmt/src/main/java/com/azure/resourcemanager/dns/DnsManagementClient.java b/sdk/dns/mgmt/src/main/java/com/azure/resourcemanager/dns/DnsManagementClient.java index 8a82220944c3..f1e04727b896 100644 --- a/sdk/dns/mgmt/src/main/java/com/azure/resourcemanager/dns/DnsManagementClient.java +++ b/sdk/dns/mgmt/src/main/java/com/azure/resourcemanager/dns/DnsManagementClient.java @@ -8,7 +8,7 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.management.AzureEnvironment; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.AzureServiceClient; +import com.azure.resourcemanager.resources.fluentcore.AzureServiceClient; import com.azure.resourcemanager.dns.fluent.RecordSetsClient; import com.azure.resourcemanager.dns.fluent.ZonesClient; diff --git a/sdk/e2e/pom.xml b/sdk/e2e/pom.xml index 9a6e3aaaf896..c6508af00fd6 100644 --- a/sdk/e2e/pom.xml +++ b/sdk/e2e/pom.xml @@ -23,7 +23,7 @@ com.azure azure-core - 1.7.0-beta.1 + 1.7.0-beta.2 com.azure diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md index f1bfc607efe8..8096798b8c95 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md @@ -3,6 +3,9 @@ ## 1.2.0-beta.1 (Unreleased) +## 1.1.2 (2020-07-08) +- Updated dependency version of `azure-messaging-eventhubs` to `5.1.2` + ## 1.1.1 (2020-06-12) - Updated dependency version of `azure-messaging-eventhubs` to `5.1.1` diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md index ffe6d59c2ab5..4ce717a44c16 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md @@ -27,7 +27,7 @@ documentation][event_hubs_product_docs] | [Samples][sample_examples] com.azure azure-messaging-eventhubs-checkpointstore-blob - 1.1.1 + 1.1.2 ``` [//]: # ({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 859cdcb77784..4c11b5e81cf0 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/pom.xml +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/pom.xml @@ -45,14 +45,14 @@ com.azure azure-storage-blob - 12.7.0 + 12.8.0-beta.1 com.azure azure-identity - 1.0.7 + 1.0.8 test diff --git a/sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md b/sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md index b1bc3161fa09..ff15808af8da 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md +++ b/sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md @@ -3,6 +3,10 @@ ## 5.2.0-beta.1 (Unreleased) +## 5.1.2 (2020-07-08) +- Updated dependency version of `azure-core-amqp` which has a bug fix for updating User Agent string format. +- Fix bug where batch receive handler runs on non-blocking thread and fails on blocking calls. + ## 5.1.1 (2020-06-12) - Fix bug where receiver link fails to add credits to new links created after an existing link is closed. - Add a check to load balancer task to not run if the previous load balancer task is still in progress. diff --git a/sdk/eventhubs/azure-messaging-eventhubs/README.md b/sdk/eventhubs/azure-messaging-eventhubs/README.md index 8b7987c75542..032e6312ba21 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/README.md +++ b/sdk/eventhubs/azure-messaging-eventhubs/README.md @@ -59,7 +59,7 @@ documentation][event_hubs_product_docs] | [Samples][sample_examples] com.azure azure-messaging-eventhubs - 5.1.1 + 5.1.2 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/pom.xml b/sdk/eventhubs/azure-messaging-eventhubs/pom.xml index c9200f744bac..77f57dd7c059 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/pom.xml +++ b/sdk/eventhubs/azure-messaging-eventhubs/pom.xml @@ -37,7 +37,7 @@ com.azure azure-core - 1.6.0 + 1.7.0-beta.1 com.azure @@ -49,7 +49,7 @@ com.azure azure-identity - 1.0.7 + 1.0.8 test diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionBasedLoadBalancer.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionBasedLoadBalancer.java index f387314a784f..909ef1105d58 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionBasedLoadBalancer.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionBasedLoadBalancer.java @@ -10,7 +10,6 @@ import com.azure.messaging.eventhubs.models.PartitionOwnership; import java.util.concurrent.atomic.AtomicBoolean; import reactor.core.Exceptions; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.util.function.Tuple2; @@ -22,7 +21,6 @@ import java.util.Map.Entry; import java.util.Random; import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.Collectors; @@ -123,12 +121,6 @@ void loadBalance() { final Mono> partitionsMono = eventHubAsyncClient .getPartitionIds() .timeout(Duration.ofMinutes(1)) - .onErrorResume(TimeoutException.class, error -> { - // In the subsequent step where it tries to balance the load, it'll propagate an error to the user. - // So it is okay to return an empty Flux. - logger.warning("Unable to get partitionIds from eventHubAsyncClient."); - return Flux.empty(); - }) .collectList(); Mono.zip(partitionOwnershipMono, partitionsMono) 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 7303b8c217b4..aa41cdd1b7ce 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 @@ -43,6 +43,7 @@ import java.util.stream.Collectors; import reactor.core.publisher.Flux; import reactor.core.publisher.Signal; +import reactor.core.scheduler.Schedulers; /** * The partition pump manager that keeps track of all the partition pumps started by this {@link EventProcessorClient}. @@ -164,37 +165,30 @@ void startPartitionPump(PartitionOwnership claimedOwnership, Checkpoint checkpoi partitionPumps.put(claimedOwnership.getPartitionId(), eventHubConsumer); //@formatter:off + Flux> partitionEventFlux; if (maxWaitTime != null) { - eventHubConsumer + partitionEventFlux = eventHubConsumer .receiveFromPartition(claimedOwnership.getPartitionId(), startFromEventPosition, receiveOptions) - .windowTimeout(maxBatchSize, maxWaitTime) - .flatMap(Flux::collectList) - .subscribe(partitionEventBatch -> processEvents(partitionContext, partitionProcessor, - eventHubConsumer, partitionEventBatch), - /* EventHubConsumer receive() returned an error */ - ex -> handleError(claimedOwnership, eventHubConsumer, partitionProcessor, ex, partitionContext), - () -> { - partitionProcessor.close(new CloseContext(partitionContext, - CloseReason.EVENT_PROCESSOR_SHUTDOWN)); - cleanup(claimedOwnership, eventHubConsumer); - }); + .windowTimeout(maxBatchSize, maxWaitTime); } else { - eventHubConsumer + partitionEventFlux = eventHubConsumer .receiveFromPartition(claimedOwnership.getPartitionId(), startFromEventPosition, receiveOptions) - .window(maxBatchSize) - .flatMap(Flux::collectList) - .subscribe(partitionEventBatch -> { - processEvents(partitionContext, partitionProcessor, - eventHubConsumer, partitionEventBatch); - }, - /* EventHubConsumer receive() returned an error */ - ex -> handleError(claimedOwnership, eventHubConsumer, partitionProcessor, ex, partitionContext), - () -> { - partitionProcessor.close(new CloseContext(partitionContext, - CloseReason.EVENT_PROCESSOR_SHUTDOWN)); - cleanup(claimedOwnership, eventHubConsumer); - }); + .window(maxBatchSize); } + partitionEventFlux + .flatMap(Flux::collectList) + .publishOn(Schedulers.boundedElastic()) + .subscribe(partitionEventBatch -> { + processEvents(partitionContext, partitionProcessor, + eventHubConsumer, partitionEventBatch); + }, + /* EventHubConsumer receive() returned an error */ + ex -> handleError(claimedOwnership, eventHubConsumer, partitionProcessor, ex, partitionContext), + () -> { + partitionProcessor.close(new CloseContext(partitionContext, + CloseReason.EVENT_PROCESSOR_SHUTDOWN)); + cleanup(claimedOwnership, eventHubConsumer); + }); //@formatter:on } catch (Exception ex) { if (partitionPumps.containsKey(claimedOwnership.getPartitionId())) { diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventDataJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventDataJavaDocCodeSamples.java deleted file mode 100644 index 96cb1077756d..000000000000 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventDataJavaDocCodeSamples.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.messaging.eventhubs; - -import static java.nio.charset.StandardCharsets.UTF_8; - -/** - * Contains code snippets when generating javadocs through doclets for {@link EventData}. - */ -public class EventDataJavaDocCodeSamples { - - /** - * Creates an EventData using application properties. - */ - public void createEventData() { - // BEGIN: com.azure.messaging.eventhubs.eventdata.getProperties - TelemetryEvent telemetry = new TelemetryEvent("temperature", "37"); - byte[] serializedTelemetryData = telemetry.toString().getBytes(UTF_8); - - EventData eventData = new EventData(serializedTelemetryData); - eventData.getProperties().put("eventType", TelemetryEvent.class.getName()); - // END: com.azure.messaging.eventhubs.eventdata.getProperties - } - - private static final class TelemetryEvent { - private final String name; - private final String value; - - private TelemetryEvent(String name, String value) { - this.name = name; - this.value = value; - } - - @Override - public String toString() { - return String.format("[name]=%s;[value]=%s", name, value); - } - } -} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubClientBuilderJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubClientBuilderJavaDocCodeSamples.java deleted file mode 100644 index 29ce00fbf27e..000000000000 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubClientBuilderJavaDocCodeSamples.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.messaging.eventhubs; - -/** - * Code snippets for {@link EventHubClientBuilder}. - */ -public class EventHubClientBuilderJavaDocCodeSamples { - /** - * Code snippet for {@link EventHubClientBuilder#shareConnection()}. - */ - public void sharingConnection() { - // BEGIN: com.azure.messaging.eventhubs.eventhubclientbuilder.instantiation - // Toggling `shareConnection` instructs the builder to use the same underlying connection - // for each consumer or producer created using the same builder instance. - EventHubClientBuilder builder = new EventHubClientBuilder() - .connectionString("event-hubs-instance-connection-string") - .shareConnection(); - - // Both the producer and consumer created share the same underlying connection. - EventHubProducerAsyncClient producer = builder.buildAsyncProducerClient(); - EventHubConsumerAsyncClient consumer = builder - .consumerGroup("my-consumer-group") - .buildAsyncConsumerClient(); - // END: com.azure.messaging.eventhubs.eventhubclientbuilder.instantiation - } -} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientJavaDocCodeSamples.java deleted file mode 100644 index c39136ee3133..000000000000 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientJavaDocCodeSamples.java +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.messaging.eventhubs; - -import com.azure.messaging.eventhubs.models.EventPosition; -import com.azure.messaging.eventhubs.models.LastEnqueuedEventProperties; -import com.azure.messaging.eventhubs.models.PartitionContext; -import com.azure.messaging.eventhubs.models.PartitionEvent; -import com.azure.messaging.eventhubs.models.ReceiveOptions; -import org.reactivestreams.Subscription; -import reactor.core.Disposable; -import reactor.core.publisher.BaseSubscriber; - -import java.util.concurrent.atomic.AtomicInteger; - -/** - * Code snippets demonstrating various {@link EventHubConsumerAsyncClient} scenarios. - */ -public class EventHubConsumerAsyncClientJavaDocCodeSamples { - private final EventHubConsumerAsyncClient consumer = new EventHubClientBuilder() - .connectionString("fake-string") - .consumerGroup("consumer-group-name") - .buildAsyncConsumerClient(); - - public void initialization() { - // BEGIN: com.azure.messaging.eventhubs.eventhubconsumerasyncclient.instantiation - // The required parameters are `consumerGroup` and a way to authenticate with Event Hubs using credentials. - EventHubConsumerAsyncClient consumer = new EventHubClientBuilder() - .connectionString("Endpoint={fully-qualified-namespace};SharedAccessKeyName={policy-name};" - + "SharedAccessKey={key};EntityPath={eh-name}") - .consumerGroup("consumer-group-name") - .buildAsyncConsumerClient(); - // END: com.azure.messaging.eventhubs.eventhubconsumerasyncclient.instantiation - - consumer.close(); - } - - /** - * Receives event data from a single partition. - */ - public void receive() { - - // BEGIN: com.azure.messaging.eventhubs.eventhubconsumerasyncclient.receive#string-eventposition - // Obtain partitionId from EventHubConsumerAsyncClient.getPartitionIds() - String partitionId = "0"; - EventPosition startingPosition = EventPosition.latest(); - - // Keep a reference to `subscription`. When the program is finished receiving events, call - // subscription.dispose(). This will stop fetching events from the Event Hub. - Disposable subscription = consumer.receiveFromPartition(partitionId, startingPosition) - .subscribe(partitionEvent -> { - PartitionContext partitionContext = partitionEvent.getPartitionContext(); - EventData event = partitionEvent.getData(); - - System.out.printf("Received event from partition '%s'%n", partitionContext.getPartitionId()); - System.out.printf("Contents of event as string: '%s'%n", event.getBodyAsString()); - }, error -> System.err.print(error.toString())); - // END: com.azure.messaging.eventhubs.eventhubconsumerasyncclient.receive#string-eventposition - - // When program ends, or you're done receiving all events. - subscription.dispose(); - } - - /** - * Receives event data with back pressure. - */ - public void receiveBackpressure() { - // Obtain partitionId from EventHubAsyncClient.getPartitionIds() - String partitionId = "0"; - - EventHubConsumerAsyncClient consumer = new EventHubClientBuilder() - .connectionString("fake-string") - .consumerGroup("consumer-group-name") - .buildAsyncConsumerClient(); - - // BEGIN: com.azure.messaging.eventhubs.eventhubconsumerasyncclient.receive#string-eventposition-basesubscriber - consumer.receiveFromPartition(partitionId, EventPosition.latest()).subscribe(new BaseSubscriber() { - private static final int NUMBER_OF_EVENTS = 5; - private final AtomicInteger currentNumberOfEvents = new AtomicInteger(); - - @Override - protected void hookOnSubscribe(Subscription subscription) { - // Tell the Publisher we only want 5 events at a time. - request(NUMBER_OF_EVENTS); - } - - @Override - protected void hookOnNext(PartitionEvent value) { - // Process the EventData - - // If the number of events we have currently received is a multiple of 5, that means we have reached the - // last event the Publisher will provide to us. Invoking request(long) here, tells the Publisher that - // the subscriber is ready to get more events from upstream. - if (currentNumberOfEvents.incrementAndGet() % 5 == 0) { - request(NUMBER_OF_EVENTS); - } - } - }); - // END: com.azure.messaging.eventhubs.eventhubconsumerasyncclient.receive#string-eventposition-basesubscriber - } - - /** - * Receives from all partitions. - */ - public void receiveAll() { - EventHubConsumerAsyncClient consumer = new EventHubClientBuilder() - .connectionString("fake-string") - .consumerGroup("consumer-group-name") - .buildAsyncConsumerClient(); - - // BEGIN: com.azure.messaging.eventhubs.eventhubconsumerasyncclient.receive#boolean - // Receives events from all partitions from the beginning of each partition. - consumer.receive(true).subscribe(partitionEvent -> { - PartitionContext context = partitionEvent.getPartitionContext(); - EventData event = partitionEvent.getData(); - System.out.printf("Event %s is from partition %s%n.", event.getSequenceNumber(), context.getPartitionId()); - }); - // END: com.azure.messaging.eventhubs.eventhubconsumerasyncclient.receive#boolean - } - - /** - * Receives from all partitions with last enqueued information. - */ - public void receiveLastEnqueuedInformation() { - EventHubConsumerAsyncClient consumer = new EventHubClientBuilder() - .connectionString("event-hub-instance-connection-string") - .consumerGroup("consumer-group-name") - .buildAsyncConsumerClient(); - - // BEGIN: com.azure.messaging.eventhubs.eventhubconsumerasyncclient.receiveFromPartition#string-eventposition-receiveoptions - // Set `setTrackLastEnqueuedEventProperties` to true to get the last enqueued information from the partition for - // each event that is received. - ReceiveOptions receiveOptions = new ReceiveOptions() - .setTrackLastEnqueuedEventProperties(true); - - // Receives events from partition "0" as they come in. - consumer.receiveFromPartition("0", EventPosition.earliest(), receiveOptions) - .subscribe(partitionEvent -> { - LastEnqueuedEventProperties properties = partitionEvent.getLastEnqueuedEventProperties(); - System.out.printf("Information received at %s. Last enqueued sequence number: %s%n", - properties.getRetrievalTime(), - properties.getSequenceNumber()); - }); - // END: com.azure.messaging.eventhubs.eventhubconsumerasyncclient.receiveFromPartition#string-eventposition-receiveoptions - } -} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubConsumerJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubConsumerJavaDocCodeSamples.java deleted file mode 100644 index 49bb72f61efb..000000000000 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubConsumerJavaDocCodeSamples.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.messaging.eventhubs; - -import com.azure.core.util.IterableStream; -import com.azure.messaging.eventhubs.models.EventPosition; -import com.azure.messaging.eventhubs.models.PartitionEvent; - -import java.time.Duration; -import java.time.Instant; - -/** - * Code snippets demonstrating various {@link EventHubConsumerClient} scenarios. - */ -public class EventHubConsumerJavaDocCodeSamples { - /** - * Code snippet for creating an EventHubConsumer - * - */ - public void instantiate() { - // BEGIN: com.azure.messaging.eventhubs.eventhubconsumerclient.instantiation - // The required parameters are `consumerGroup`, and a way to authenticate with Event Hubs using credentials. - EventHubConsumerClient consumer = new EventHubClientBuilder() - .connectionString( - "Endpoint={eh-namespace};SharedAccessKeyName={policy-name};SharedAccessKey={key};Entity-Path={hub-name}") - .consumerGroup("$DEFAULT") - .buildConsumerClient(); - // END: com.azure.messaging.eventhubs.eventhubconsumerclient.instantiation - - consumer.close(); - } - - /** - * Receives event data from a single partition. - */ - public void receive() { - EventHubConsumerClient consumer = new EventHubClientBuilder() - .connectionString("event-hub-instance-connection-string") - .consumerGroup("consumer-group-name") - .buildConsumerClient(); - - // BEGIN: com.azure.messaging.eventhubs.eventhubconsumerclient.receive#string-int-eventposition-duration - Instant twelveHoursAgo = Instant.now().minus(Duration.ofHours(12)); - EventPosition startingPosition = EventPosition.fromEnqueuedTime(twelveHoursAgo); - String partitionId = "0"; - - // Reads events from partition '0' and returns the first 100 received or until the 30 seconds has elapsed. - IterableStream events = consumer.receiveFromPartition(partitionId, 100, - startingPosition, Duration.ofSeconds(30)); - - Long lastSequenceNumber = -1L; - for (PartitionEvent partitionEvent : events) { - // For each event, perform some sort of processing. - System.out.print("Event received: " + partitionEvent.getData().getSequenceNumber()); - lastSequenceNumber = partitionEvent.getData().getSequenceNumber(); - } - - // Figure out what the next EventPosition to receive from is based on last event we processed in the stream. - // If lastSequenceNumber is -1L, then we didn't see any events the first time we fetched events from the - // partition. - if (lastSequenceNumber != -1L) { - EventPosition nextPosition = EventPosition.fromSequenceNumber(lastSequenceNumber, false); - - // Gets the next set of events from partition '0' to consume and process. - IterableStream nextEvents = consumer.receiveFromPartition(partitionId, 100, - nextPosition, Duration.ofSeconds(30)); - } - // END: com.azure.messaging.eventhubs.eventhubconsumerclient.receive#string-int-eventposition-duration - } -} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubProducerAsyncClientJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubProducerAsyncClientJavaDocCodeSamples.java deleted file mode 100644 index 859c98119570..000000000000 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubProducerAsyncClientJavaDocCodeSamples.java +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.messaging.eventhubs; - -import com.azure.messaging.eventhubs.models.CreateBatchOptions; -import com.azure.messaging.eventhubs.models.SendOptions; -import java.util.Arrays; -import java.util.List; -import reactor.core.Exceptions; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.util.concurrent.atomic.AtomicReference; - -import static java.nio.charset.StandardCharsets.UTF_8; - -/** - * Contains code snippets when generating javadocs through doclets for {@link EventHubProducerAsyncClient}. - */ -public class EventHubProducerAsyncClientJavaDocCodeSamples { - private final EventHubClientBuilder builder = new EventHubClientBuilder(); - - /** - * Code snippet demonstrating how to create an {@link EventHubProducerAsyncClient}. - */ - public void instantiate() { - // BEGIN: com.azure.messaging.eventhubs.eventhubasyncproducerclient.instantiation - // The required parameter is a way to authenticate with Event Hubs using credentials. - // The connectionString provides a way to authenticate with Event Hub. - EventHubProducerAsyncClient producer = new EventHubClientBuilder() - .connectionString( - "Endpoint={fully-qualified-namespace};SharedAccessKeyName={policy-name};SharedAccessKey={key}", - "event-hub-name") - .buildAsyncProducerClient(); - // END: com.azure.messaging.eventhubs.eventhubasyncproducerclient.instantiation - - producer.close(); - } - - /** - * Code snippet demonstrating how to send a batch that automatically routes events to any partition. - */ - public void batchAutomaticRouting() { - // BEGIN: com.azure.messaging.eventhubs.eventhubasyncproducerclient.createBatch - // The required parameter is a way to authenticate with Event Hubs using credentials. - // The connectionString provides a way to authenticate with Event Hub. - EventHubProducerAsyncClient producer = new EventHubClientBuilder() - .connectionString( - "Endpoint={fully-qualified-namespace};SharedAccessKeyName={policy-name};SharedAccessKey={key}", - "event-hub-name") - .buildAsyncProducerClient(); - - // Creating a batch without options set, will allow for automatic routing of events to any partition. - producer.createBatch().flatMap(batch -> { - batch.tryAdd(new EventData("test-event-1")); - batch.tryAdd(new EventData("test-event-2")); - return producer.send(batch); - }).subscribe(unused -> { - }, - error -> System.err.println("Error occurred while sending batch:" + error), - () -> System.out.println("Send complete.")); - // END: com.azure.messaging.eventhubs.eventhubasyncproducerclient.createBatch - - producer.close(); - } - - /** - * Code snippet demonstrating how to create an EventDataBatch at routes events to a single partition. - */ - public void batchPartitionId() { - EventHubProducerAsyncClient producer = builder.buildAsyncProducerClient(); - - // BEGIN: com.azure.messaging.eventhubs.eventhubasyncproducerclient.createBatch#CreateBatchOptions-partitionId - // Creating a batch with partitionId set will route all events in that batch to partition `foo`. - CreateBatchOptions options = new CreateBatchOptions().setPartitionId("foo"); - producer.createBatch(options).flatMap(batch -> { - batch.tryAdd(new EventData("test-event-1")); - batch.tryAdd(new EventData("test-event-2")); - return producer.send(batch); - }).subscribe(unused -> { - }, - error -> System.err.println("Error occurred while sending batch:" + error), - () -> System.out.println("Send complete.")); - // END: com.azure.messaging.eventhubs.eventhubasyncproducerclient.createBatch#CreateBatchOptions-partitionId - - producer.close(); - } - - /** - * Code snippet demonstrating how to send events with a partition key. - */ - public void batchPartitionKey() { - EventHubProducerAsyncClient producer = builder.buildAsyncProducerClient(); - - // BEGIN: com.azure.messaging.eventhubs.eventhubasyncproducerclient.createBatch#CreateBatchOptions-partitionKey - // Creating a batch with partitionKey set will tell the service to hash the partitionKey and decide which - // partition to send the events to. Events with the same partitionKey are always routed to the same partition. - CreateBatchOptions options = new CreateBatchOptions().setPartitionKey("bread"); - producer.createBatch(options).flatMap(batch -> { - batch.tryAdd(new EventData("sourdough")); - batch.tryAdd(new EventData("rye")); - return producer.send(batch); - }).subscribe(unused -> { - }, - error -> System.err.println("Error occurred while sending batch:" + error), - () -> System.out.println("Send complete.")); - // END: com.azure.messaging.eventhubs.eventhubasyncproducerclient.createBatch#CreateBatchOptions-partitionKey - } - - /** - * Code snippet demonstrating how to create a size-limited {@link EventDataBatch} and send it. - */ - public void batchSizeLimited() { - final EventHubProducerAsyncClient producer = builder.buildAsyncProducerClient(); - final EventData firstEvent = new EventData("92".getBytes(UTF_8)); - firstEvent.getProperties().put("telemetry", "latency"); - final EventData secondEvent = new EventData("98".getBytes(UTF_8)); - secondEvent.getProperties().put("telemetry", "cpu-temperature"); - - // BEGIN: com.azure.messaging.eventhubs.eventhubasyncproducerclient.createBatch#CreateBatchOptions-int - final Flux telemetryEvents = Flux.just(firstEvent, secondEvent); - - // Setting `setMaximumSizeInBytes` when creating a batch, limits the size of that batch. - // In this case, all the batches created with these options are limited to 256 bytes. - final CreateBatchOptions options = new CreateBatchOptions() - .setMaximumSizeInBytes(256); - final AtomicReference currentBatch = new AtomicReference<>( - producer.createBatch(options).block()); - - // The sample Flux contains two events, but it could be an infinite stream of telemetry events. - telemetryEvents.flatMap(event -> { - final EventDataBatch batch = currentBatch.get(); - if (batch.tryAdd(event)) { - return Mono.empty(); - } - - return Mono.when( - producer.send(batch), - producer.createBatch(options).map(newBatch -> { - currentBatch.set(newBatch); - - // Add the event that did not fit in the previous batch. - if (!newBatch.tryAdd(event)) { - throw Exceptions.propagate(new IllegalArgumentException( - "Event was too large to fit in an empty batch. Max size: " + newBatch.getMaxSizeInBytes())); - } - - return newBatch; - })); - }).then() - .doFinally(signal -> { - final EventDataBatch batch = currentBatch.getAndSet(null); - if (batch != null && batch.getCount() > 0) { - producer.send(batch).block(); - } - }); - // END: com.azure.messaging.eventhubs.eventhubasyncproducerclient.createBatch#CreateBatchOptions-int - } - - /** - * Code snippet to demonstrate how to send a list of events using - * {@link EventHubProducerAsyncClient#send(Iterable)}. - */ - public void sendIterableSample() { - final EventHubProducerAsyncClient producer = builder.buildAsyncProducerClient(); - // BEGIN: com.azure.messaging.eventhubs.eventhubasyncproducerclient.send#Iterable - List events = Arrays.asList(new EventData("maple"), new EventData("aspen"), - new EventData("oak")); - producer - .send(events) - .subscribe(unused -> { }, - error -> System.err.println("Error occurred while sending events:" + error), - () -> System.out.println("Send complete.")); - // END: com.azure.messaging.eventhubs.eventhubasyncproducerclient.send#Iterable - } - - /** - * Code snippet to demonstrate how to send a list of events using - * {@link EventHubProducerAsyncClient#send(Iterable, SendOptions)}. - */ - public void sendIterableWithPartitionKeySample() { - final EventHubProducerAsyncClient producer = builder.buildAsyncProducerClient(); - // BEGIN: com.azure.messaging.eventhubs.eventhubasyncproducerclient.send#Iterable-SendOptions - List events = Arrays.asList(new EventData("Melbourne"), new EventData("London"), - new EventData("New York")); - SendOptions sendOptions = new SendOptions().setPartitionKey("cities"); - producer - .send(events, sendOptions) - .subscribe(unused -> { }, - error -> System.err.println("Error occurred while sending events:" + error), - () -> System.out.println("Send complete.")); - // END: com.azure.messaging.eventhubs.eventhubasyncproducerclient.send#Iterable-SendOptions - } -} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubProducerClientJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubProducerClientJavaDocCodeSamples.java deleted file mode 100644 index ff39b7f88947..000000000000 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubProducerClientJavaDocCodeSamples.java +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.messaging.eventhubs; - -import com.azure.messaging.eventhubs.models.CreateBatchOptions; - -import com.azure.messaging.eventhubs.models.SendOptions; -import java.util.Arrays; -import java.util.List; - -import static java.nio.charset.StandardCharsets.UTF_8; - -/** - * Contains code snippets when generating javadocs through doclets for {@link EventHubProducerClient}. - */ -public class EventHubProducerClientJavaDocCodeSamples { - private final EventHubClientBuilder builder = new EventHubClientBuilder() - .connectionString("fake-string"); - - /** - * Code snippet demonstrating how to create an {@link EventHubProducerClient}. - */ - public void instantiate() { - // BEGIN: com.azure.messaging.eventhubs.eventhubproducerclient.instantiation - // The required parameter is a way to authenticate with Event Hubs using credentials. - // The connectionString provides a way to authenticate with Event Hub. - EventHubProducerClient producer = new EventHubClientBuilder() - .connectionString( - "Endpoint={fully-qualified-namespace};SharedAccessKeyName={policy-name};SharedAccessKey={key}", - "event-hub-name") - .buildProducerClient(); - // END: com.azure.messaging.eventhubs.eventhubproducerclient.instantiation - - producer.close(); - } - - /** - * Code snippet demonstrating how to send a batch that automatically routes events to any partition. - * - * @throws IllegalArgumentException if an event is too large for an empty batch. - */ - public void batchAutomaticRouting() { - // BEGIN: com.azure.messaging.eventhubs.eventhubproducerclient.createBatch - // The required parameter is a way to authenticate with Event Hubs using credentials. - // The connectionString provides a way to authenticate with Event Hub. - EventHubProducerClient producer = new EventHubClientBuilder() - .connectionString( - "Endpoint={fully-qualified-namespace};SharedAccessKeyName={policy-name};SharedAccessKey={key}", - "event-hub-name") - .buildProducerClient(); - List events = Arrays.asList(new EventData("test-event-1"), new EventData("test-event-2")); - - // Creating a batch without options set, will allow for automatic routing of events to any partition. - EventDataBatch batch = producer.createBatch(); - for (EventData event : events) { - if (batch.tryAdd(event)) { - continue; - } - - producer.send(batch); - batch = producer.createBatch(); - if (!batch.tryAdd(event)) { - throw new IllegalArgumentException("Event is too large for an empty batch."); - } - } - // END: com.azure.messaging.eventhubs.eventhubproducerclient.createBatch - - producer.close(); - } - - /** - * Code snippet demonstrating how to create an EventDataBatch at routes events to a single partition. - */ - public void batchPartitionId() { - final EventHubProducerClient producer = builder.buildProducerClient(); - - // BEGIN: com.azure.messaging.eventhubs.eventhubproducerclient.createBatch#CreateBatchOptions-partitionId - // Creating a batch with partitionId set will route all events in that batch to partition `foo`. - CreateBatchOptions options = new CreateBatchOptions().setPartitionId("foo"); - - EventDataBatch batch = producer.createBatch(options); - batch.tryAdd(new EventData("data-to-partition-foo")); - producer.send(batch); - // END: com.azure.messaging.eventhubs.eventhubproducerclient.createBatch#CreateBatchOptions-partitionId - } - - /** - * Code snippet demonstrating how to send events with a partition key. - */ - public void batchPartitionKey() { - final EventHubProducerClient producer = builder.buildProducerClient(); - - // BEGIN: com.azure.messaging.eventhubs.eventhubproducerclient.createBatch#CreateBatchOptions-partitionKey - List events = Arrays.asList(new EventData("sourdough"), new EventData("rye"), - new EventData("wheat")); - - // Creating a batch with partitionKey set will tell the service to hash the partitionKey and decide which - // partition to send the events to. Events with the same partitionKey are always routed to the same partition. - CreateBatchOptions options = new CreateBatchOptions().setPartitionKey("bread"); - EventDataBatch batch = producer.createBatch(options); - - events.forEach(event -> batch.tryAdd(event)); - producer.send(batch); - // END: com.azure.messaging.eventhubs.eventhubproducerclient.createBatch#CreateBatchOptions-partitionKey - } - - /** - * Code snippet demonstrating how to create a size-limited {@link EventDataBatch} and send it. - * - * @throws IllegalArgumentException if an event is too large for an empty batch. - */ - public void batchSizeLimited() { - final EventHubProducerClient producer = builder.buildProducerClient(); - final EventData firstEvent = new EventData("92".getBytes(UTF_8)); - firstEvent.getProperties().put("telemetry", "latency"); - final EventData secondEvent = new EventData("98".getBytes(UTF_8)); - secondEvent.getProperties().put("telemetry", "cpu-temperature"); - final EventData thirdEvent = new EventData("120".getBytes(UTF_8)); - thirdEvent.getProperties().put("telemetry", "fps"); - - // BEGIN: com.azure.messaging.eventhubs.eventhubproducerclient.createBatch#CreateBatchOptions-int - - - final List telemetryEvents = Arrays.asList(firstEvent, secondEvent, thirdEvent); - - // Setting `setMaximumSizeInBytes` when creating a batch, limits the size of that batch. - // In this case, all the batches created with these options are limited to 256 bytes. - final CreateBatchOptions options = new CreateBatchOptions() - .setMaximumSizeInBytes(256); - - EventDataBatch currentBatch = producer.createBatch(options); - - // For each telemetry event, we try to add it to the current batch. - // When the batch is full, send it then create another batch to add more events to. - for (EventData event : telemetryEvents) { - if (!currentBatch.tryAdd(event)) { - producer.send(currentBatch); - currentBatch = producer.createBatch(options); - - // Add the event we couldn't before. - if (!currentBatch.tryAdd(event)) { - throw new IllegalArgumentException("Event is too large for an empty batch."); - } - } - } - // END: com.azure.messaging.eventhubs.eventhubproducerclient.createBatch#CreateBatchOptions-int - } - - /** - * Code snippet to demonstrate how to send a list of events using {@link EventHubProducerClient#send(Iterable)}. - */ - public void sendIterableSample() { - final EventHubProducerClient producer = builder.buildProducerClient(); - // BEGIN: com.azure.messaging.eventhubs.eventhubproducerclient.send#Iterable - List events = Arrays.asList(new EventData("maple"), new EventData("aspen"), - new EventData("oak")); - producer.send(events); - // END: com.azure.messaging.eventhubs.eventhubproducerclient.send#Iterable - } - - /** - * Code snippet to demonstrate how to send a list of events using - * {@link EventHubProducerClient#send(Iterable, SendOptions)}. - */ - public void sendIterableWithPartitionKeySample() { - final EventHubProducerClient producer = builder.buildProducerClient(); - // BEGIN: com.azure.messaging.eventhubs.eventhubproducerclient.send#Iterable-SendOptions - List events = Arrays.asList(new EventData("Melbourne"), new EventData("London"), - new EventData("New York")); - SendOptions sendOptions = new SendOptions().setPartitionKey("cities"); - producer.send(events, sendOptions); - // END: com.azure.messaging.eventhubs.eventhubproducerclient.send#Iterable-SendOptions - } - -} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubsJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubsJavaDocCodeSamples.java new file mode 100644 index 000000000000..462ed1eb3486 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubsJavaDocCodeSamples.java @@ -0,0 +1,670 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import static java.nio.charset.StandardCharsets.UTF_8; + +import com.azure.core.util.IterableStream; +import com.azure.messaging.eventhubs.models.CreateBatchOptions; +import com.azure.messaging.eventhubs.models.EventPosition; +import com.azure.messaging.eventhubs.models.LastEnqueuedEventProperties; +import com.azure.messaging.eventhubs.models.PartitionContext; +import com.azure.messaging.eventhubs.models.PartitionEvent; +import com.azure.messaging.eventhubs.models.ReceiveOptions; +import com.azure.messaging.eventhubs.models.SendOptions; +import java.time.Duration; +import java.time.Instant; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; +import org.reactivestreams.Subscription; +import reactor.core.Disposable; +import reactor.core.Exceptions; +import reactor.core.publisher.BaseSubscriber; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * This class contains all code snippets that are used in Event Hubs JavaDocs. + */ +public class EventHubsJavaDocCodeSamples { + private final EventHubClientBuilder builder = new EventHubClientBuilder(); + private final EventHubConsumerAsyncClient consumer = builder + .connectionString("fake-string") + .consumerGroup("consumer-group-name") + .buildAsyncConsumerClient(); + + /** + * Creates an EventData using application properties. + */ + public void createEventData() { + // BEGIN: com.azure.messaging.eventhubs.eventdata.getProperties + TelemetryEvent telemetry = new TelemetryEvent("temperature", "37"); + byte[] serializedTelemetryData = telemetry.toString().getBytes(UTF_8); + + EventData eventData = new EventData(serializedTelemetryData); + eventData.getProperties().put("eventType", TelemetryEvent.class.getName()); + // END: com.azure.messaging.eventhubs.eventdata.getProperties + } + + /** + * Code snippet for {@link EventHubClientBuilder#shareConnection()}. + */ + public void sharingConnection() { + // BEGIN: com.azure.messaging.eventhubs.eventhubclientbuilder.instantiation + // Toggling `shareConnection` instructs the builder to use the same underlying connection + // for each consumer or producer created using the same builder instance. + EventHubClientBuilder builder = new EventHubClientBuilder() + .connectionString("event-hubs-instance-connection-string") + .shareConnection(); + + // Both the producer and consumer created share the same underlying connection. + EventHubProducerAsyncClient producer = builder.buildAsyncProducerClient(); + EventHubConsumerAsyncClient consumer = builder + .consumerGroup("my-consumer-group") + .buildAsyncConsumerClient(); + // END: com.azure.messaging.eventhubs.eventhubclientbuilder.instantiation + } + + + public void instantiateConsumerAsyncClient() { + // BEGIN: com.azure.messaging.eventhubs.eventhubconsumerasyncclient.instantiation + // The required parameters are `consumerGroup` and a way to authenticate with Event Hubs using credentials. + EventHubConsumerAsyncClient consumer = new EventHubClientBuilder() + .connectionString("Endpoint={fully-qualified-namespace};SharedAccessKeyName={policy-name};" + + "SharedAccessKey={key};EntityPath={eh-name}") + .consumerGroup("consumer-group-name") + .buildAsyncConsumerClient(); + // END: com.azure.messaging.eventhubs.eventhubconsumerasyncclient.instantiation + + consumer.close(); + } + + /** + * Receives event data from a single partition. + */ + public void receive() { + + // BEGIN: com.azure.messaging.eventhubs.eventhubconsumerasyncclient.receive#string-eventposition + // Obtain partitionId from EventHubConsumerAsyncClient.getPartitionIds() + String partitionId = "0"; + EventPosition startingPosition = EventPosition.latest(); + + // Keep a reference to `subscription`. When the program is finished receiving events, call + // subscription.dispose(). This will stop fetching events from the Event Hub. + Disposable subscription = consumer.receiveFromPartition(partitionId, startingPosition) + .subscribe(partitionEvent -> { + PartitionContext partitionContext = partitionEvent.getPartitionContext(); + EventData event = partitionEvent.getData(); + + System.out.printf("Received event from partition '%s'%n", partitionContext.getPartitionId()); + System.out.printf("Contents of event as string: '%s'%n", event.getBodyAsString()); + }, error -> System.err.print(error.toString())); + // END: com.azure.messaging.eventhubs.eventhubconsumerasyncclient.receive#string-eventposition + + // When program ends, or you're done receiving all events. + subscription.dispose(); + } + + /** + * Receives event data with back pressure. + */ + public void receiveBackpressure() { + // Obtain partitionId from EventHubAsyncClient.getPartitionIds() + String partitionId = "0"; + + EventHubConsumerAsyncClient consumer = new EventHubClientBuilder() + .connectionString("fake-string") + .consumerGroup("consumer-group-name") + .buildAsyncConsumerClient(); + + // BEGIN: com.azure.messaging.eventhubs.eventhubconsumerasyncclient.receive#string-eventposition-basesubscriber + consumer.receiveFromPartition(partitionId, EventPosition.latest()).subscribe(new BaseSubscriber() { + private static final int NUMBER_OF_EVENTS = 5; + private final AtomicInteger currentNumberOfEvents = new AtomicInteger(); + + @Override + protected void hookOnSubscribe(Subscription subscription) { + // Tell the Publisher we only want 5 events at a time. + request(NUMBER_OF_EVENTS); + } + + @Override + protected void hookOnNext(PartitionEvent value) { + // Process the EventData + + // If the number of events we have currently received is a multiple of 5, that means we have reached the + // last event the Publisher will provide to us. Invoking request(long) here, tells the Publisher that + // the subscriber is ready to get more events from upstream. + if (currentNumberOfEvents.incrementAndGet() % 5 == 0) { + request(NUMBER_OF_EVENTS); + } + } + }); + // END: com.azure.messaging.eventhubs.eventhubconsumerasyncclient.receive#string-eventposition-basesubscriber + } + + /** + * Receives from all partitions. + */ + public void receiveAll() { + EventHubConsumerAsyncClient consumer = new EventHubClientBuilder() + .connectionString("fake-string") + .consumerGroup("consumer-group-name") + .buildAsyncConsumerClient(); + + // BEGIN: com.azure.messaging.eventhubs.eventhubconsumerasyncclient.receive#boolean + // Receives events from all partitions from the beginning of each partition. + consumer.receive(true).subscribe(partitionEvent -> { + PartitionContext context = partitionEvent.getPartitionContext(); + EventData event = partitionEvent.getData(); + System.out.printf("Event %s is from partition %s%n.", event.getSequenceNumber(), context.getPartitionId()); + }); + // END: com.azure.messaging.eventhubs.eventhubconsumerasyncclient.receive#boolean + } + + /** + * Receives from all partitions with last enqueued information. + */ + public void receiveLastEnqueuedInformation() { + EventHubConsumerAsyncClient consumer = new EventHubClientBuilder() + .connectionString("event-hub-instance-connection-string") + .consumerGroup("consumer-group-name") + .buildAsyncConsumerClient(); + + // BEGIN: com.azure.messaging.eventhubs.eventhubconsumerasyncclient.receiveFromPartition#string-eventposition-receiveoptions + // Set `setTrackLastEnqueuedEventProperties` to true to get the last enqueued information from the partition for + // each event that is received. + ReceiveOptions receiveOptions = new ReceiveOptions() + .setTrackLastEnqueuedEventProperties(true); + + // Receives events from partition "0" as they come in. + consumer.receiveFromPartition("0", EventPosition.earliest(), receiveOptions) + .subscribe(partitionEvent -> { + LastEnqueuedEventProperties properties = partitionEvent.getLastEnqueuedEventProperties(); + System.out.printf("Information received at %s. Last enqueued sequence number: %s%n", + properties.getRetrievalTime(), + properties.getSequenceNumber()); + }); + // END: com.azure.messaging.eventhubs.eventhubconsumerasyncclient.receiveFromPartition#string-eventposition-receiveoptions + } + + + /** + * Code snippet for creating an EventHubConsumer + */ + public void instantiateConsumerClient() { + // BEGIN: com.azure.messaging.eventhubs.eventhubconsumerclient.instantiation + // The required parameters are `consumerGroup`, and a way to authenticate with Event Hubs using credentials. + EventHubConsumerClient consumer = new EventHubClientBuilder() + .connectionString( + "Endpoint={eh-namespace};SharedAccessKeyName={policy-name};SharedAccessKey={key};Entity-Path={hub-name}") + .consumerGroup("$DEFAULT") + .buildConsumerClient(); + // END: com.azure.messaging.eventhubs.eventhubconsumerclient.instantiation + + consumer.close(); + } + + /** + * Receives event data from a single partition. + */ + public void receiveFromSinglePartition() { + EventHubConsumerClient consumer = new EventHubClientBuilder() + .connectionString("event-hub-instance-connection-string") + .consumerGroup("consumer-group-name") + .buildConsumerClient(); + + // BEGIN: com.azure.messaging.eventhubs.eventhubconsumerclient.receive#string-int-eventposition-duration + Instant twelveHoursAgo = Instant.now().minus(Duration.ofHours(12)); + EventPosition startingPosition = EventPosition.fromEnqueuedTime(twelveHoursAgo); + String partitionId = "0"; + + // Reads events from partition '0' and returns the first 100 received or until the 30 seconds has elapsed. + IterableStream events = consumer.receiveFromPartition(partitionId, 100, + startingPosition, Duration.ofSeconds(30)); + + Long lastSequenceNumber = -1L; + for (PartitionEvent partitionEvent : events) { + // For each event, perform some sort of processing. + System.out.print("Event received: " + partitionEvent.getData().getSequenceNumber()); + lastSequenceNumber = partitionEvent.getData().getSequenceNumber(); + } + + // Figure out what the next EventPosition to receive from is based on last event we processed in the stream. + // If lastSequenceNumber is -1L, then we didn't see any events the first time we fetched events from the + // partition. + if (lastSequenceNumber != -1L) { + EventPosition nextPosition = EventPosition.fromSequenceNumber(lastSequenceNumber, false); + + // Gets the next set of events from partition '0' to consume and process. + IterableStream nextEvents = consumer.receiveFromPartition(partitionId, 100, + nextPosition, Duration.ofSeconds(30)); + } + // END: com.azure.messaging.eventhubs.eventhubconsumerclient.receive#string-int-eventposition-duration + } + + + /** + * Code snippet demonstrating how to create an {@link EventHubProducerAsyncClient}. + */ + public void instantiateProducerAsyncClient() { + // BEGIN: com.azure.messaging.eventhubs.eventhubasyncproducerclient.instantiation + // The required parameter is a way to authenticate with Event Hubs using credentials. + // The connectionString provides a way to authenticate with Event Hub. + EventHubProducerAsyncClient producer = new EventHubClientBuilder() + .connectionString( + "Endpoint={fully-qualified-namespace};SharedAccessKeyName={policy-name};SharedAccessKey={key}", + "event-hub-name") + .buildAsyncProducerClient(); + // END: com.azure.messaging.eventhubs.eventhubasyncproducerclient.instantiation + + producer.close(); + } + + /** + * Code snippet demonstrating how to send a batch that automatically routes events to any partition. + */ + public void batchAutomaticRoutingAsync() { + // BEGIN: com.azure.messaging.eventhubs.eventhubasyncproducerclient.createBatch + // The required parameter is a way to authenticate with Event Hubs using credentials. + // The connectionString provides a way to authenticate with Event Hub. + EventHubProducerAsyncClient producer = new EventHubClientBuilder() + .connectionString( + "Endpoint={fully-qualified-namespace};SharedAccessKeyName={policy-name};SharedAccessKey={key}", + "event-hub-name") + .buildAsyncProducerClient(); + + // Creating a batch without options set, will allow for automatic routing of events to any partition. + producer.createBatch().flatMap(batch -> { + batch.tryAdd(new EventData("test-event-1")); + batch.tryAdd(new EventData("test-event-2")); + return producer.send(batch); + }).subscribe(unused -> { }, + error -> System.err.println("Error occurred while sending batch:" + error), + () -> System.out.println("Send complete.")); + // END: com.azure.messaging.eventhubs.eventhubasyncproducerclient.createBatch + + producer.close(); + } + + /** + * Code snippet demonstrating how to create an EventDataBatch at routes events to a single partition. + */ + public void batchPartitionIdAsync() { + EventHubProducerAsyncClient producer = builder.buildAsyncProducerClient(); + + // BEGIN: com.azure.messaging.eventhubs.eventhubasyncproducerclient.createBatch#CreateBatchOptions-partitionId + // Creating a batch with partitionId set will route all events in that batch to partition `foo`. + CreateBatchOptions options = new CreateBatchOptions().setPartitionId("foo"); + producer.createBatch(options).flatMap(batch -> { + batch.tryAdd(new EventData("test-event-1")); + batch.tryAdd(new EventData("test-event-2")); + return producer.send(batch); + }).subscribe(unused -> { }, + error -> System.err.println("Error occurred while sending batch:" + error), + () -> System.out.println("Send complete.")); + // END: com.azure.messaging.eventhubs.eventhubasyncproducerclient.createBatch#CreateBatchOptions-partitionId + + producer.close(); + } + + /** + * Code snippet demonstrating how to send events with a partition key. + */ + public void batchPartitionKeyAsync() { + EventHubProducerAsyncClient producer = builder.buildAsyncProducerClient(); + + // BEGIN: com.azure.messaging.eventhubs.eventhubasyncproducerclient.createBatch#CreateBatchOptions-partitionKey + // Creating a batch with partitionKey set will tell the service to hash the partitionKey and decide which + // partition to send the events to. Events with the same partitionKey are always routed to the same partition. + CreateBatchOptions options = new CreateBatchOptions().setPartitionKey("bread"); + producer.createBatch(options).flatMap(batch -> { + batch.tryAdd(new EventData("sourdough")); + batch.tryAdd(new EventData("rye")); + return producer.send(batch); + }).subscribe(unused -> { }, + error -> System.err.println("Error occurred while sending batch:" + error), + () -> System.out.println("Send complete.")); + // END: com.azure.messaging.eventhubs.eventhubasyncproducerclient.createBatch#CreateBatchOptions-partitionKey + } + + /** + * Code snippet demonstrating how to create a size-limited {@link EventDataBatch} and send it. + */ + public void batchSizeLimitedAsync() { + final EventHubProducerAsyncClient producer = builder.buildAsyncProducerClient(); + final EventData firstEvent = new EventData("92".getBytes(UTF_8)); + firstEvent.getProperties().put("telemetry", "latency"); + final EventData secondEvent = new EventData("98".getBytes(UTF_8)); + secondEvent.getProperties().put("telemetry", "cpu-temperature"); + + // BEGIN: com.azure.messaging.eventhubs.eventhubasyncproducerclient.createBatch#CreateBatchOptions-int + final Flux telemetryEvents = Flux.just(firstEvent, secondEvent); + + // Setting `setMaximumSizeInBytes` when creating a batch, limits the size of that batch. + // In this case, all the batches created with these options are limited to 256 bytes. + final CreateBatchOptions options = new CreateBatchOptions() + .setMaximumSizeInBytes(256); + final AtomicReference currentBatch = new AtomicReference<>( + producer.createBatch(options).block()); + + // The sample Flux contains two events, but it could be an infinite stream of telemetry events. + telemetryEvents.flatMap(event -> { + final EventDataBatch batch = currentBatch.get(); + if (batch.tryAdd(event)) { + return Mono.empty(); + } + + return Mono.when( + producer.send(batch), + producer.createBatch(options).map(newBatch -> { + currentBatch.set(newBatch); + + // Add the event that did not fit in the previous batch. + if (!newBatch.tryAdd(event)) { + throw Exceptions.propagate(new IllegalArgumentException( + "Event was too large to fit in an empty batch. Max size: " + newBatch.getMaxSizeInBytes())); + } + + return newBatch; + })); + }).then() + .doFinally(signal -> { + final EventDataBatch batch = currentBatch.getAndSet(null); + if (batch != null && batch.getCount() > 0) { + producer.send(batch).block(); + } + }); + // END: com.azure.messaging.eventhubs.eventhubasyncproducerclient.createBatch#CreateBatchOptions-int + } + + /** + * Code snippet to demonstrate how to send a list of events using + * {@link EventHubProducerAsyncClient#send(Iterable)}. + */ + public void sendIterableSampleAsync() { + final EventHubProducerAsyncClient producer = builder.buildAsyncProducerClient(); + // BEGIN: com.azure.messaging.eventhubs.eventhubasyncproducerclient.send#Iterable + List events = Arrays.asList(new EventData("maple"), new EventData("aspen"), + new EventData("oak")); + producer + .send(events) + .subscribe(unused -> { }, + error -> System.err.println("Error occurred while sending events:" + error), + () -> System.out.println("Send complete.")); + // END: com.azure.messaging.eventhubs.eventhubasyncproducerclient.send#Iterable + } + + /** + * Code snippet to demonstrate how to send a list of events using + * {@link EventHubProducerAsyncClient#send(Iterable, SendOptions)}. + */ + public void sendIterableWithPartitionKeySampleAsync() { + final EventHubProducerAsyncClient producer = builder.buildAsyncProducerClient(); + // BEGIN: com.azure.messaging.eventhubs.eventhubasyncproducerclient.send#Iterable-SendOptions + List events = Arrays.asList(new EventData("Melbourne"), new EventData("London"), + new EventData("New York")); + SendOptions sendOptions = new SendOptions().setPartitionKey("cities"); + producer + .send(events, sendOptions) + .subscribe(unused -> { }, + error -> System.err.println("Error occurred while sending events:" + error), + () -> System.out.println("Send complete.")); + // END: com.azure.messaging.eventhubs.eventhubasyncproducerclient.send#Iterable-SendOptions + } + + /** + * Code snippet demonstrating how to create an {@link EventHubProducerClient}. + */ + public void instantiateProducerClient() { + // BEGIN: com.azure.messaging.eventhubs.eventhubproducerclient.instantiation + // The required parameter is a way to authenticate with Event Hubs using credentials. + // The connectionString provides a way to authenticate with Event Hub. + EventHubProducerClient producer = new EventHubClientBuilder() + .connectionString( + "Endpoint={fully-qualified-namespace};SharedAccessKeyName={policy-name};SharedAccessKey={key}", + "event-hub-name") + .buildProducerClient(); + // END: com.azure.messaging.eventhubs.eventhubproducerclient.instantiation + + producer.close(); + } + + /** + * Code snippet demonstrating how to send a batch that automatically routes events to any partition. + * + * @throws IllegalArgumentException if an event is too large for an empty batch. + */ + public void batchAutomaticRouting() { + // BEGIN: com.azure.messaging.eventhubs.eventhubproducerclient.createBatch + // The required parameter is a way to authenticate with Event Hubs using credentials. + // The connectionString provides a way to authenticate with Event Hub. + EventHubProducerClient producer = new EventHubClientBuilder() + .connectionString( + "Endpoint={fully-qualified-namespace};SharedAccessKeyName={policy-name};SharedAccessKey={key}", + "event-hub-name") + .buildProducerClient(); + List events = Arrays.asList(new EventData("test-event-1"), new EventData("test-event-2")); + + // Creating a batch without options set, will allow for automatic routing of events to any partition. + EventDataBatch batch = producer.createBatch(); + for (EventData event : events) { + if (batch.tryAdd(event)) { + continue; + } + + producer.send(batch); + batch = producer.createBatch(); + if (!batch.tryAdd(event)) { + throw new IllegalArgumentException("Event is too large for an empty batch."); + } + } + // END: com.azure.messaging.eventhubs.eventhubproducerclient.createBatch + + producer.close(); + } + + /** + * Code snippet demonstrating how to create an EventDataBatch at routes events to a single partition. + */ + public void batchPartitionId() { + final EventHubProducerClient producer = builder.buildProducerClient(); + + // BEGIN: com.azure.messaging.eventhubs.eventhubproducerclient.createBatch#CreateBatchOptions-partitionId + // Creating a batch with partitionId set will route all events in that batch to partition `foo`. + CreateBatchOptions options = new CreateBatchOptions().setPartitionId("foo"); + + EventDataBatch batch = producer.createBatch(options); + batch.tryAdd(new EventData("data-to-partition-foo")); + producer.send(batch); + // END: com.azure.messaging.eventhubs.eventhubproducerclient.createBatch#CreateBatchOptions-partitionId + } + + /** + * Code snippet demonstrating how to send events with a partition key. + */ + public void batchPartitionKey() { + final EventHubProducerClient producer = builder.buildProducerClient(); + + // BEGIN: com.azure.messaging.eventhubs.eventhubproducerclient.createBatch#CreateBatchOptions-partitionKey + List events = Arrays.asList(new EventData("sourdough"), new EventData("rye"), + new EventData("wheat")); + + // Creating a batch with partitionKey set will tell the service to hash the partitionKey and decide which + // partition to send the events to. Events with the same partitionKey are always routed to the same partition. + CreateBatchOptions options = new CreateBatchOptions().setPartitionKey("bread"); + EventDataBatch batch = producer.createBatch(options); + + events.forEach(event -> batch.tryAdd(event)); + producer.send(batch); + // END: com.azure.messaging.eventhubs.eventhubproducerclient.createBatch#CreateBatchOptions-partitionKey + } + + /** + * Code snippet demonstrating how to create a size-limited {@link EventDataBatch} and send it. + * + * @throws IllegalArgumentException if an event is too large for an empty batch. + */ + public void batchSizeLimited() { + final EventHubProducerClient producer = builder.buildProducerClient(); + final EventData firstEvent = new EventData("92".getBytes(UTF_8)); + firstEvent.getProperties().put("telemetry", "latency"); + final EventData secondEvent = new EventData("98".getBytes(UTF_8)); + secondEvent.getProperties().put("telemetry", "cpu-temperature"); + final EventData thirdEvent = new EventData("120".getBytes(UTF_8)); + thirdEvent.getProperties().put("telemetry", "fps"); + + // BEGIN: com.azure.messaging.eventhubs.eventhubproducerclient.createBatch#CreateBatchOptions-int + + + final List telemetryEvents = Arrays.asList(firstEvent, secondEvent, thirdEvent); + + // Setting `setMaximumSizeInBytes` when creating a batch, limits the size of that batch. + // In this case, all the batches created with these options are limited to 256 bytes. + final CreateBatchOptions options = new CreateBatchOptions() + .setMaximumSizeInBytes(256); + + EventDataBatch currentBatch = producer.createBatch(options); + + // For each telemetry event, we try to add it to the current batch. + // When the batch is full, send it then create another batch to add more events to. + for (EventData event : telemetryEvents) { + if (!currentBatch.tryAdd(event)) { + producer.send(currentBatch); + currentBatch = producer.createBatch(options); + + // Add the event we couldn't before. + if (!currentBatch.tryAdd(event)) { + throw new IllegalArgumentException("Event is too large for an empty batch."); + } + } + } + // END: com.azure.messaging.eventhubs.eventhubproducerclient.createBatch#CreateBatchOptions-int + } + + /** + * Code snippet to demonstrate how to send a list of events using {@link EventHubProducerClient#send(Iterable)}. + */ + public void sendIterableSample() { + final EventHubProducerClient producer = builder.buildProducerClient(); + // BEGIN: com.azure.messaging.eventhubs.eventhubproducerclient.send#Iterable + List events = Arrays.asList(new EventData("maple"), new EventData("aspen"), + new EventData("oak")); + producer.send(events); + // END: com.azure.messaging.eventhubs.eventhubproducerclient.send#Iterable + } + + /** + * Code snippet to demonstrate how to send a list of events using + * {@link EventHubProducerClient#send(Iterable, SendOptions)}. + */ + public void sendIterableWithPartitionKeySample() { + final EventHubProducerClient producer = builder.buildProducerClient(); + // BEGIN: com.azure.messaging.eventhubs.eventhubproducerclient.send#Iterable-SendOptions + List events = Arrays.asList(new EventData("Melbourne"), new EventData("London"), + new EventData("New York")); + SendOptions sendOptions = new SendOptions().setPartitionKey("cities"); + producer.send(events, sendOptions); + // END: com.azure.messaging.eventhubs.eventhubproducerclient.send#Iterable-SendOptions + } + + /** + * Code snippet for showing how to create a new instance of {@link EventProcessorClient}. + * + * @return A new instance of {@link EventProcessorClient} + */ + // BEGIN: com.azure.messaging.eventhubs.eventprocessorclientbuilder.instantiation + public EventProcessorClient createEventProcessor() { + String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" + + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; + + EventProcessorClient eventProcessorClient = new EventProcessorClientBuilder() + .consumerGroup("consumer-group") + .checkpointStore(new SampleCheckpointStore()) + .processEvent(eventContext -> { + System.out.println("Partition id = " + eventContext.getPartitionContext().getPartitionId() + + "and sequence number of event = " + eventContext.getEventData().getSequenceNumber()); + }) + .processError(errorContext -> { + System.out.printf("Error occurred in partition processor for partition {}, {}", + errorContext.getPartitionContext().getPartitionId(), + errorContext.getThrowable()); + }) + .connectionString(connectionString) + .buildEventProcessorClient(); + return eventProcessorClient; + } + // END: com.azure.messaging.eventhubs.eventprocessorclientbuilder.instantiation + + /** + * Code snippet to show creation of an event processor that receives events in batches. + */ + public void receiveBatchSample() { + String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" + + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; + + // BEGIN: com.azure.messaging.eventhubs.eventprocessorclientbuilder.batchreceive + EventProcessorClient eventProcessorClient = new EventProcessorClientBuilder() + .consumerGroup("consumer-group") + .checkpointStore(new SampleCheckpointStore()) + .processEventBatch(eventBatchContext -> { + eventBatchContext.getEvents().forEach(eventData -> { + System.out.println("Partition id = " + eventBatchContext.getPartitionContext().getPartitionId() + + "and sequence number of event = " + eventData.getSequenceNumber()); + }); + }, 50, Duration.ofSeconds(30)) + .processError(errorContext -> { + System.out.printf("Error occurred in partition processor for partition {}, {}", + errorContext.getPartitionContext().getPartitionId(), + errorContext.getThrowable()); + }) + .connectionString(connectionString) + .buildEventProcessorClient(); + // END: com.azure.messaging.eventhubs.eventprocessorclientbuilder.batchreceive + } + + /** + * Code snippet for showing how to start and stop an {@link EventProcessorClient}. + */ + public void startStopSample() { + String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" + + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; + EventProcessorClient eventProcessorClient = new EventProcessorClientBuilder() + .connectionString(connectionString) + .processEvent(eventContext -> { + System.out.println("Partition id = " + eventContext.getPartitionContext().getPartitionId() + " and " + + "sequence number of event = " + eventContext.getEventData().getSequenceNumber()); + }) + .processError(errorContext -> { + System.out.printf("Error occurred in partition processor for partition {}, {}", + errorContext.getPartitionContext().getPartitionId(), + errorContext.getThrowable()); + }) + .consumerGroup("consumer-group") + .buildEventProcessorClient(); + + // BEGIN: com.azure.messaging.eventhubs.eventprocessorclient.startstop + eventProcessorClient.start(); + // Continue to perform other tasks while the processor is running in the background. + eventProcessorClient.stop(); + // END: com.azure.messaging.eventhubs.eventprocessorclient.startstop + } + + private static final class TelemetryEvent { + private final String name; + private final String value; + + private TelemetryEvent(String name, String value) { + this.name = name; + this.value = value; + } + + @Override + public String toString() { + return String.format("[name]=%s;[value]=%s", name, value); + } + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorBuilderJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorBuilderJavaDocCodeSamples.java deleted file mode 100644 index 04a4ad841c92..000000000000 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorBuilderJavaDocCodeSamples.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.messaging.eventhubs; - -import java.time.Duration; - -/** - * Code snippets for {@link EventProcessorClientBuilder}. - */ -public class EventProcessorBuilderJavaDocCodeSamples { - - /** - * Code snippet for showing how to create a new instance of {@link EventProcessorClient}. - * - * @return A new instance of {@link EventProcessorClient} - */ - // BEGIN: com.azure.messaging.eventhubs.eventprocessorclientbuilder.instantiation - public EventProcessorClient createEventProcessor() { - String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" - + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; - - EventProcessorClient eventProcessorClient = new EventProcessorClientBuilder() - .consumerGroup("consumer-group") - .checkpointStore(new SampleCheckpointStore()) - .processEvent(eventContext -> { - System.out.println("Partition id = " + eventContext.getPartitionContext().getPartitionId() - + "and sequence number of event = " + eventContext.getEventData().getSequenceNumber()); - }) - .processError(errorContext -> { - System.out.printf("Error occurred in partition processor for partition {}, {}", - errorContext.getPartitionContext().getPartitionId(), - errorContext.getThrowable()); - }) - .connectionString(connectionString) - .buildEventProcessorClient(); - return eventProcessorClient; - } - // END: com.azure.messaging.eventhubs.eventprocessorclientbuilder.instantiation - - /** - * Code snippet to show creation of an event processor that receives events in batches. - */ - public void receiveBatchSample() { - String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" - + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; - - // BEGIN: com.azure.messaging.eventhubs.eventprocessorclientbuilder.batchreceive - EventProcessorClient eventProcessorClient = new EventProcessorClientBuilder() - .consumerGroup("consumer-group") - .checkpointStore(new SampleCheckpointStore()) - .processEventBatch(eventBatchContext -> { - eventBatchContext.getEvents().forEach(eventData -> { - System.out.println("Partition id = " + eventBatchContext.getPartitionContext().getPartitionId() - + "and sequence number of event = " + eventData.getSequenceNumber()); - }); - }, 50, Duration.ofSeconds(30)) - .processError(errorContext -> { - System.out.printf("Error occurred in partition processor for partition {}, {}", - errorContext.getPartitionContext().getPartitionId(), - errorContext.getThrowable()); - }) - .connectionString(connectionString) - .buildEventProcessorClient(); - // END: com.azure.messaging.eventhubs.eventprocessorclientbuilder.batchreceive - } - -} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorClientJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorClientJavaDocCodeSamples.java deleted file mode 100644 index 6a43081a63be..000000000000 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorClientJavaDocCodeSamples.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.messaging.eventhubs; - -/** - * Code snippets for {@link EventProcessorClient}. - */ -public final class EventProcessorClientJavaDocCodeSamples { - - /** - * Code snippet for showing how to start and stop an {@link EventProcessorClient}. - */ - public void startStopSample() { - String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" - + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; - EventProcessorClient eventProcessorClient = new EventProcessorClientBuilder() - .connectionString(connectionString) - .processEvent(eventContext -> { - System.out.println("Partition id = " + eventContext.getPartitionContext().getPartitionId() + " and " - + "sequence number of event = " + eventContext.getEventData().getSequenceNumber()); - }) - .processError(errorContext -> { - System.out.printf("Error occurred in partition processor for partition {}, {}", - errorContext.getPartitionContext().getPartitionId(), - errorContext.getThrowable()); - }) - .consumerGroup("consumer-group") - .buildEventProcessorClient(); - - // BEGIN: com.azure.messaging.eventhubs.eventprocessorclient.startstop - eventProcessorClient.start(); - // Continue to perform other tasks while the processor is running in the background. - eventProcessorClient.stop(); - // END: com.azure.messaging.eventhubs.eventprocessorclient.startstop - } -} diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md b/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md index 162ff520b38f..11a6b1faf6d4 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md +++ b/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md @@ -1,7 +1,13 @@ # Release History -## 1.0.0-beta.4 (Unreleased) +## 1.0.0-beta.5 (Unreleased) + + +## 1.0.0-beta.4 (2020-07-07) ### Breaking Changes +- `beginRecognizeReceipt` APIs now return a `RecognizedForm` model instead of a `RecognizedReceipt`. See +[this](https://github.com/Azure/azure-sdk-for-java/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/StronglyTypedRecognizedFormUSReceipt.java) +suggested approach for extracting information from receipts. - Methods returning `textContent` have been renamed to `fieldElements` on `FieldData` and `FormTableCell` - Renamed `FormContent` to `FormElement` - Renamed `FieldText` to `FieldData` diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/README.md b/sdk/formrecognizer/azure-ai-formrecognizer/README.md index 1ba2bd54919b..48541a47825d 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/README.md +++ b/sdk/formrecognizer/azure-ai-formrecognizer/README.md @@ -23,7 +23,7 @@ from form documents. It includes the following main functionalities: com.azure azure-ai-formrecognizer - 1.0.0-beta.3 + 1.0.0-beta.4 ``` [//]: # ({x-version-update-end}) @@ -121,7 +121,7 @@ Authentication with AAD requires some initial setup: com.azure azure-identity - 1.0.6 + 1.0.8 ``` [//]: # ({x-version-update-end}) @@ -177,7 +177,7 @@ followed by polling the service at intervals to determine whether the operation succeeded, to get the result. Methods that train models or recognize values from forms are modeled as long-running operations. The client exposes -a `begin` method that returns a `SyncPoller` or `PollerFlux` instance. +a `begin` method that returns a `SyncPoller` or `PollerFlux` instance. Callers should wait for the operation to completed by calling `getFinalResult()` on the returned operation from the `begin` method. Sample code snippets are provided to illustrate using long-running operations [below](#Examples). @@ -195,7 +195,7 @@ The following section provides several code snippets covering some of the most c ### Recognize Forms Using a Custom Model Recognize name/value pairs and table data from forms. These models are trained with your own data, so they're tailored to your forms. You should only recognize forms of the same form type that the custom model was trained on. - + ```java String formUrl = "{form_url}"; String modelId = "{custom_trained_model_id}"; @@ -206,20 +206,19 @@ List recognizedForms = recognizeFormPoller.getFinalResult(); for (int i = 0; i < recognizedForms.size(); i++) { RecognizedForm form = recognizedForms.get(i); - System.out.printf("----------- Recognized Form %d-----------%n", i); + System.out.printf("----------- Recognized Form %d -----------%n", i); System.out.printf("Form type: %s%n", form.getFormType()); - form.getFields().forEach((label, formField) -> { + form.getFields().forEach((label, formField) -> System.out.printf("Field %s has value %s with confidence score of %f.%n", label, formField.getValueData().getText(), - formField.getConfidence()); - }); - System.out.print("-----------------------------------"); + formField.getConfidence()) + ); } ``` ### Recognize Content Recognize text and table structures, along with their bounding box coordinates, from documents. - + ```java // recognize form content using file input stream File form = new File("local/file_path/filename.png"); @@ -233,7 +232,7 @@ List contentPageResults = recognizeContentPoller.getFinalResult(); for (int i = 0; i < contentPageResults.size(); i++) { FormPage formPage = contentPageResults.get(i); - System.out.printf("----Recognizing content for page %d----%n", i); + System.out.printf("----Recognizing content for page %d ----%n", i); // Table information System.out.printf("Has width: %f and height: %f, measured with unit: %s.%n", formPage.getWidth(), formPage.getHeight(), @@ -241,64 +240,75 @@ for (int i = 0; i < contentPageResults.size(); i++) { formPage.getTables().forEach(formTable -> { System.out.printf("Table has %d rows and %d columns.%n", formTable.getRowCount(), formTable.getColumnCount()); - formTable.getCells().forEach(formTableCell -> { - System.out.printf("Cell has text %s.%n", formTableCell.getText()); - }); - System.out.println(); + formTable.getCells().forEach(formTableCell -> + System.out.printf("Cell has text %s.%n", formTableCell.getText())); }); } ``` ### Recognize receipts -Recognize data from a USA sales receipts using a prebuilt model. [Here][service_recognize_receipt] are the fields the -service returns for a recognized receipt. - +Recognize data from a USA sales receipts using a prebuilt model. [Here][service_recognize_receipt] are the fields the service returns for a recognized receipt. See [StronglyTypedRecognizedForm.java][strongly_typed_sample] for a suggested approach to extract +information from receipts. + + ```java String receiptUrl = "https://docs.microsoft.com/en-us/azure/cognitive-services/form-recognizer/media" + "/contoso-allinone.jpg"; -SyncPoller> syncPoller = +SyncPoller> syncPoller = formRecognizerClient.beginRecognizeReceiptsFromUrl(receiptUrl); -List receiptPageResults = syncPoller.getFinalResult(); +List receiptPageResults = syncPoller.getFinalResult(); for (int i = 0; i < receiptPageResults.size(); i++) { - RecognizedReceipt recognizedReceipt = receiptPageResults.get(i); - Map recognizedFields = recognizedReceipt.getRecognizedForm().getFields(); + RecognizedForm recognizedForm = receiptPageResults.get(i); + Map> recognizedFields = recognizedForm.getFields(); System.out.printf("----------- Recognized Receipt page %d -----------%n", i); - FormField merchantNameField = recognizedFields.get("MerchantName"); - if (merchantNameField.getFieldValue().getType() == FieldValueType.STRING) { - System.out.printf("Merchant Name: %s, confidence: %.2f%n", - merchantNameField.getFieldValue().asString(), - merchantNameField.getConfidence()); + FormField merchantNameField = recognizedFields.get("MerchantName"); + if (merchantNameField != null) { + if (FieldValueType.STRING.equals(merchantNameField.getValueType())) { + String merchantName = FieldValueType.STRING.cast(merchantNameField); + System.out.printf("Merchant Name: %s, confidence: %.2f%n", + merchantName, merchantNameField.getConfidence()); + } } - FormField transactionDateField = recognizedFields.get("TransactionDate"); - if (transactionDateField.getFieldValue().getType() == FieldValueType.DATE) { - System.out.printf("Transaction Date: %s, confidence: %.2f%n", - transactionDateField.getFieldValue().asDate(), - transactionDateField.getConfidence()); + + FormField merchantPhoneNumberField = recognizedFields.get("MerchantPhoneNumber"); + if (merchantPhoneNumberField != null) { + if (FieldValueType.PHONE_NUMBER.equals(merchantNameField.getValueType())) { + String merchantAddress = FieldValueType.PHONE_NUMBER.cast(merchantPhoneNumberField); + System.out.printf("Merchant Phone number: %s, confidence: %.2f%n", + merchantAddress, merchantPhoneNumberField.getConfidence()); + } } - FormField receiptItemsField = recognizedFields.get("Items"); - System.out.printf("Receipt Items: %n"); - if (receiptItemsField.getFieldValue().getType() == FieldValueType.LIST) { - List receiptItems = receiptItemsField.getFieldValue().asList(); - receiptItems.forEach(receiptItem -> { - if (receiptItem.getFieldValue().getType() == FieldValueType.MAP) { - receiptItem.getFieldValue().asMap().forEach((key, formField) -> { - if (key.equals("Name")) { - if (formField.getFieldValue().getType() == FieldValueType.STRING) { - System.out.printf("Name: %s, confidence: %.2fs%n", - formField.getFieldValue().asString(), - formField.getConfidence()); - } - } - if (key.equals("Quantity")) { - if (formField.getFieldValue().getType() == FieldValueType.INTEGER) { - System.out.printf("Quantity: %d, confidence: %.2f%n", - formField.getFieldValue().asInteger(), formField.getConfidence()); + + FormField transactionDateField = recognizedFields.get("TransactionDate"); + if (transactionDateField != null) { + if (FieldValueType.DATE.equals(transactionDateField.getValueType())) { + LocalDate transactionDate = FieldValueType.DATE.cast(transactionDateField); + System.out.printf("Transaction Date: %s, confidence: %.2f%n", + transactionDate, transactionDateField.getConfidence()); + } + } + + FormField receiptItemsField = recognizedFields.get("Items"); + if (receiptItemsField != null) { + System.out.printf("Receipt Items: %n"); + if (FieldValueType.LIST.equals(receiptItemsField.getValueType())) { + List> receiptItems = FieldValueType.LIST.cast(receiptItemsField); + receiptItems.forEach(receiptItem -> { + if (FieldValueType.MAP.equals(receiptItem.getValueType())) { + Map> formFieldMap = FieldValueType.MAP.cast(receiptItem); + formFieldMap.forEach((key, formField) -> { + if ("Quantity".equals(key)) { + if (FieldValueType.DOUBLE.equals(formField.getValueType())) { + Float quantity = FieldValueType.DOUBLE.cast(formField); + System.out.printf("Quantity: %f, confidence: %.2f%n", + quantity, formField.getConfidence()); + } } - } - }); - } - }); + }); + } + }); + } } } ``` @@ -307,7 +317,7 @@ for (int i = 0; i < receiptPageResults.size(); i++) { Train a machine-learned model on your own form type. The resulting model will be able to recognize values from the types of forms it was trained on. Provide a container SAS url to your Azure Storage Blob container where you're storing the training documents. See details on setting this up in the [service quickstart documentation][quickstart_training]. - + ```java String trainingFilesUrl = "{SAS-URL-of-your-container-in-blob-storage}"; SyncPoller trainingPoller = @@ -334,7 +344,7 @@ customFormModel.getSubmodels().forEach(customFormSubmodel -> { ### Manage your models Manage the custom models attached to your account. - + ```java AtomicReference modelId = new AtomicReference<>(); // First, we see how many custom models we have, and what our limit is @@ -376,7 +386,7 @@ to provide an invalid file source URL an `HttpResponseException` would be raised In the following code snippet, the error is handled gracefully by catching the exception and display the additional information about the error. - + ```java try { formRecognizerClient.beginRecognizeContentFromUrl("invalidSourceUrl"); @@ -414,7 +424,7 @@ These code samples show common scenario operations with the Azure Form Recognize #### Async APIs All the examples shown so far have been using synchronous APIs, but we provide full support for async APIs as well. You'll need to use `FormRecognizerAsyncClient` - + ```java FormRecognizerAsyncClient formRecognizerAsyncClient = new FormRecognizerClientBuilder() .credential(new AzureKeyCredential("{key}")) @@ -498,7 +508,8 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [service_access]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account?tabs=multiservice%2Cwindows [service_doc_train_unlabeled]: https://docs.microsoft.com/azure/cognitive-services/form-recognizer/overview#train-without-labels [service_doc_train_labeled]: https://docs.microsoft.com/azure/cognitive-services/form-recognizer/overview#train-with-labels -[service_recognize_receipt]: https://westus2.dev.cognitive.microsoft.com/docs/services/form-recognizer-api-v2-preview/operations/GetAnalyzeReceiptResult +[service_recognize_receipt]: https://aka.ms/azsdk/python/formrecognizer/receiptfields +[strongly_typed_sample]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/StronglyTypedRecognizedForm.java [source_code]: src [quickstart_training]: https://docs.microsoft.com/azure/cognitive-services/form-recognizer/quickstarts/curl-train-extract#train-a-form-recognizer-model [wiki_identity]: https://github.com/Azure/azure-sdk-for-java/wiki/Identity-and-Authentication diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/pom.xml b/sdk/formrecognizer/azure-ai-formrecognizer/pom.xml index a6b6d4f43755..cd6cf4ce2ad1 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/pom.xml +++ b/sdk/formrecognizer/azure-ai-formrecognizer/pom.xml @@ -13,7 +13,7 @@ com.azure azure-ai-formrecognizer - 1.0.0-beta.4 + 1.0.0-beta.5 Microsoft Azure client library for Form Recognizer This package contains the Microsoft Azure Cognitive Services Form Recognizer SDK. @@ -36,7 +36,7 @@ com.azure azure-core - 1.6.0 + 1.7.0-beta.1 com.azure @@ -78,7 +78,7 @@ com.azure azure-identity - 1.0.7 + 1.0.8 test diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/FormRecognizerAsyncClient.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/FormRecognizerAsyncClient.java index 6f35bf31af36..6e9dc5a0a962 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/FormRecognizerAsyncClient.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/FormRecognizerAsyncClient.java @@ -16,7 +16,6 @@ import com.azure.ai.formrecognizer.models.OperationResult; import com.azure.ai.formrecognizer.models.RecognizeOptions; import com.azure.ai.formrecognizer.models.RecognizedForm; -import com.azure.ai.formrecognizer.models.RecognizedReceipt; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; @@ -38,7 +37,6 @@ import java.util.UUID; import java.util.function.Function; -import static com.azure.ai.formrecognizer.Transforms.toReceipt; import static com.azure.ai.formrecognizer.Transforms.toRecognizedForm; import static com.azure.ai.formrecognizer.Transforms.toRecognizedLayout; import static com.azure.ai.formrecognizer.implementation.Utility.detectContentType; @@ -339,13 +337,13 @@ public PollerFlux> beginRecognizeContent(Flux> + public PollerFlux> beginRecognizeReceiptsFromUrl(String receiptUrl) { return beginRecognizeReceiptsFromUrl(receiptUrl, null); } @@ -364,17 +362,17 @@ public PollerFlux> beginRecognizeContent(Flux> + public PollerFlux> beginRecognizeReceiptsFromUrl(String receiptUrl, RecognizeOptions recognizeOptions) { try { recognizeOptions = getRecognizeOptionsProperties(recognizeOptions); - return new PollerFlux>( + return new PollerFlux>( recognizeOptions.getPollInterval(), receiptAnalyzeActivationOperation(receiptUrl, recognizeOptions.isIncludeFieldElements()), extractReceiptPollOperation(), @@ -403,13 +401,13 @@ public PollerFlux> beginRecognizeContent(Flux> beginRecognizeReceipts( + public PollerFlux> beginRecognizeReceipts( Flux receipt, long length) { return beginRecognizeReceipts(receipt, length, null); } @@ -433,13 +431,13 @@ public PollerFlux> beginRecognizeReceip * analyzing a receipt. * * @return A {@link PollerFlux} that polls the recognize receipt operation until it has completed, has failed, - * or has been cancelled. The completed operation returns a List of {@link RecognizedReceipt}. + * or has been cancelled. The completed operation returns a List of {@link RecognizedForm}. * @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with * an {@link OperationStatus#FAILED}. * @throws NullPointerException If {@code recognizeOptions} is {@code null}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PollerFlux> + public PollerFlux> beginRecognizeReceipts(Flux receipt, long length, RecognizeOptions recognizeOptions) { try { recognizeOptions = getRecognizeOptionsProperties(recognizeOptions); @@ -514,7 +512,7 @@ private Function, Mono> receipt }; } - private Function, Mono>> + private Function, Mono>> fetchExtractReceiptResult(boolean includeFieldElements) { return (pollingContext) -> { try { @@ -522,7 +520,8 @@ private Function, Mono> receipt return service.getAnalyzeReceiptResultWithResponseAsync(resultUid) .map(modelSimpleResponse -> { throwIfAnalyzeStatusInvalid(modelSimpleResponse.getValue()); - return toReceipt(modelSimpleResponse.getValue().getAnalyzeResult(), includeFieldElements); + return toRecognizedForm(modelSimpleResponse.getValue().getAnalyzeResult(), + includeFieldElements); }) .onErrorMap(Utility::mapToHttpResponseExceptionIfExist); } catch (RuntimeException ex) { diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/FormRecognizerClient.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/FormRecognizerClient.java index 2d0fcb6f8d42..be8c2332fc80 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/FormRecognizerClient.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/FormRecognizerClient.java @@ -11,7 +11,6 @@ import com.azure.ai.formrecognizer.models.OperationResult; import com.azure.ai.formrecognizer.models.RecognizeOptions; import com.azure.ai.formrecognizer.models.RecognizedForm; -import com.azure.ai.formrecognizer.models.RecognizedReceipt; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; @@ -257,13 +256,13 @@ public SyncPoller> beginRecognizeContent(InputSt * @param receiptUrl The URL of the receipt to analyze. * * @return A {@link SyncPoller} to poll the progress of the recognize receipt operation until it has completed, - * has failed, or has been cancelled. The completed operation returns a List of {@link RecognizedReceipt}. + * has failed, or has been cancelled. The completed operation returns a List of {@link RecognizedForm}. * @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with * an {@link OperationStatus#FAILED}. * @throws NullPointerException If {@code receiptUrl} is {@code null}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public SyncPoller> beginRecognizeReceiptsFromUrl(String receiptUrl) { + public SyncPoller> beginRecognizeReceiptsFromUrl(String receiptUrl) { return beginRecognizeReceiptsFromUrl(receiptUrl, null); } @@ -281,13 +280,13 @@ public SyncPoller> beginRecognizeReceip * analyzing a receipt. Include text lines and element references in the result. * * @return A {@link SyncPoller} to poll the progress of the recognize receipt operation until it has completed, - * has failed, or has been cancelled. The completed operation returns a List of {@link RecognizedReceipt}. + * has failed, or has been cancelled. The completed operation returns a List of {@link RecognizedForm}. * @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with * an {@link OperationStatus#FAILED}. * @throws NullPointerException If {@code receiptUrl} is {@code null}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public SyncPoller> + public SyncPoller> beginRecognizeReceiptsFromUrl(String receiptUrl, RecognizeOptions recognizeOptions) { return client.beginRecognizeReceiptsFromUrl(receiptUrl, recognizeOptions).getSyncPoller(); } @@ -306,13 +305,13 @@ public SyncPoller> beginRecognizeReceip * @param length The exact length of the data. * * @return A {@link SyncPoller} that polls the recognize receipt operation until it has completed, - * has failed, or has been cancelled. The completed operation returns a List of {@link RecognizedReceipt}. + * has failed, or has been cancelled. The completed operation returns a List of {@link RecognizedForm}. * @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with * an {@link OperationStatus#FAILED}. * @throws NullPointerException If {@code receipt} is {@code null}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public SyncPoller> + public SyncPoller> beginRecognizeReceipts(InputStream receipt, long length) { return beginRecognizeReceipts(receipt, length, null); } @@ -333,13 +332,13 @@ public SyncPoller> beginRecognizeReceip * analyzing a receipt. * * @return A {@link SyncPoller} that polls the recognize receipt operation until it has completed, has failed, - * or has been cancelled. The completed operation returns a List of {@link RecognizedReceipt}. + * or has been cancelled. The completed operation returns a List of {@link RecognizedForm}. * @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with * an {@link OperationStatus#FAILED}. * @throws NullPointerException If {@code recognizeOptions} is {@code null}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public SyncPoller> + public SyncPoller> beginRecognizeReceipts(InputStream receipt, long length, RecognizeOptions recognizeOptions) { Flux buffer = Utility.toFluxByteBuffer(receipt); return client.beginRecognizeReceipts(buffer, length, recognizeOptions).getSyncPoller(); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/Transforms.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/Transforms.java index 156c0a8f28ab..9ddbefa914a1 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/Transforms.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/Transforms.java @@ -25,7 +25,6 @@ import com.azure.ai.formrecognizer.models.LengthUnit; import com.azure.ai.formrecognizer.models.Point; import com.azure.ai.formrecognizer.models.RecognizedForm; -import com.azure.ai.formrecognizer.models.RecognizedReceipt; import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; @@ -80,7 +79,7 @@ static List toRecognizedForm(AnalyzeResult analyzeResult, boolea formPageRange = new FormPageRange(1, 1); } - Map extractedFieldMap = getUnlabeledFieldMap(documentResultItem, readResults, + Map> extractedFieldMap = getUnlabeledFieldMap(documentResultItem, readResults, includeFieldElements); extractedFormList.add(new RecognizedForm( extractedFieldMap, @@ -97,7 +96,7 @@ static List toRecognizedForm(AnalyzeResult analyzeResult, boolea if (clusterId != null) { formType.append(clusterId); } - Map extractedFieldMap = getLabeledFieldMap(includeFieldElements, readResults, + Map> extractedFieldMap = getLabeledFieldMap(includeFieldElements, readResults, pageResultItem, pageNumber); extractedFormList.add(new RecognizedForm( @@ -110,21 +109,6 @@ static List toRecognizedForm(AnalyzeResult analyzeResult, boolea return extractedFormList; } - /** - * Helper method to transform the service returned {@link AnalyzeResult} to SDK model {@link RecognizedReceipt}. - * - * @param analyzeResult The service returned result for analyze receipts. - * @param includeFieldElements Boolean to indicate if to set reference elements data on fields. - * - * @return The List of {@code RecognizedReceipt}. - */ - static List toReceipt(AnalyzeResult analyzeResult, boolean includeFieldElements) { - return toRecognizedForm(analyzeResult, includeFieldElements) - .stream() - .map(recognizedForm -> new RecognizedReceipt(recognizedForm)) - .collect(Collectors.toList()); - } - /** * Helper method to transform the service returned {@link AnalyzeResult} to SDK model {@link FormPage}. * @@ -213,9 +197,9 @@ static List getReadResultFormLines(ReadResult readResultItem) { * * @return The {@code RecognizedForm#getFields}. */ - private static Map getUnlabeledFieldMap(DocumentResult documentResultItem, + private static Map> getUnlabeledFieldMap(DocumentResult documentResultItem, List readResults, boolean includeFieldElements) { - Map extractedFieldMap = new TreeMap<>(); + Map> extractedFieldMap = new TreeMap<>(); // add receipt fields if (!CoreUtils.isNullOrEmpty(documentResultItem.getFields())) { documentResultItem.getFields().forEach((key, fieldValue) -> { @@ -233,8 +217,8 @@ private static Map getUnlabeledFieldMap(DocumentResult docume readResults)); } else { FieldData labelText = new FieldData(key, null, null, null); - extractedFieldMap.put(key, new FormField(DEFAULT_CONFIDENCE_VALUE, labelText, - key, null, null)); + extractedFieldMap.put(key, new FormField<>(DEFAULT_CONFIDENCE_VALUE, labelText, + key, null, null, null)); } }); } @@ -254,52 +238,44 @@ private static Map getUnlabeledFieldMap(DocumentResult docume * * @return The strongly typed {@link FormField} for the field input. */ - private static FormField setFormField(FieldData labelText, String key, FieldValue fieldValue, + private static FormField setFormField(FieldData labelText, String key, FieldValue fieldValue, FieldData valueText, Integer pageNumber, List readResults) { - FormField value; + FormField value; switch (fieldValue.getType()) { case PHONE_NUMBER: - value = new FormField(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, - key, new com.azure.ai.formrecognizer.models.FieldValue(FieldValueType.PHONE_NUMBER). - setFormFieldPhoneNumber(fieldValue.getValuePhoneNumber()), valueText); + value = new FormField<>(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, + key, fieldValue.getValuePhoneNumber(), valueText, FieldValueType.PHONE_NUMBER); break; case STRING: - value = new FormField(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, - key, new com.azure.ai.formrecognizer.models.FieldValue(FieldValueType.STRING) - .setFormFieldString(fieldValue.getValueString()), valueText); + value = new FormField<>(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, + key, fieldValue.getValueString(), valueText, FieldValueType.STRING); break; case TIME: LocalTime fieldTime = fieldValue.getValueTime() == null ? null : LocalTime .parse(fieldValue.getValueTime(), DateTimeFormatter.ofPattern("HH:mm:ss")); - value = new FormField(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, - key, new com.azure.ai.formrecognizer.models.FieldValue(FieldValueType.TIME) - .setFormFieldTime(fieldTime), valueText); + value = new FormField<>(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, + key, fieldTime, valueText, FieldValueType.TIME); break; case DATE: - value = new FormField(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, - key, new com.azure.ai.formrecognizer.models.FieldValue(FieldValueType.DATE) - .setFormFieldDate(fieldValue.getValueDate()), valueText); + value = new FormField<>(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, + key, fieldValue.getValueDate(), valueText, FieldValueType.DATE); break; case INTEGER: - value = new FormField(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, - key, new com.azure.ai.formrecognizer.models.FieldValue(FieldValueType.INTEGER) - .setFormFieldInteger(fieldValue.getValueInteger()), valueText); + value = new FormField<>(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, + key, fieldValue.getValueInteger(), valueText, FieldValueType.LONG); break; case NUMBER: - value = new FormField(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, - key, new com.azure.ai.formrecognizer.models.FieldValue(FieldValueType.FLOAT) - .setFormFieldFloat(fieldValue.getValueNumber()), valueText); + value = new FormField<>(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, + key, fieldValue.getValueNumber(), valueText, FieldValueType.DOUBLE); break; case ARRAY: - value = new FormField(setDefaultConfidenceValue(fieldValue.getConfidence()), null, key, - new com.azure.ai.formrecognizer.models.FieldValue(FieldValueType.LIST) - .setFormFieldList(toFormFieldArray(fieldValue.getValueArray(), readResults)), null); + value = new FormField<>(setDefaultConfidenceValue(fieldValue.getConfidence()), null, key, + toFormFieldArray(fieldValue.getValueArray(), readResults), null, FieldValueType.LIST); break; case OBJECT: - value = new FormField(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, - key, new com.azure.ai.formrecognizer.models.FieldValue(FieldValueType.MAP) - .setFormFieldMap(toFormFieldObject(fieldValue.getValueObject(), pageNumber, readResults)), valueText - ); + value = new FormField<>(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, + key, toFormFieldObject(fieldValue.getValueObject(), pageNumber, readResults), valueText, + FieldValueType.MAP); break; default: throw LOGGER.logExceptionAsError(new RuntimeException("FieldValue Type not supported")); @@ -327,9 +303,9 @@ private static float setDefaultConfidenceValue(Float confidence) { * * @return The Map of {@link FormField}. */ - private static Map toFormFieldObject(Map valueObject, + private static Map> toFormFieldObject(Map valueObject, Integer pageNumber, List readResults) { - Map fieldValueObjectMap = new TreeMap<>(); + Map> fieldValueObjectMap = new TreeMap<>(); valueObject.forEach((key, fieldValue) -> fieldValueObjectMap.put(key, setFormField(null, key, fieldValue, new FieldData(fieldValue.getText(), @@ -350,7 +326,7 @@ private static Map toFormFieldObject(Map * * @return The List of {@link FormField}. */ - private static List toFormFieldArray(List valueArray, List readResults) { + private static List> toFormFieldArray(List valueArray, List readResults) { return valueArray.stream() .map(fieldValue -> setFormField(null, null, fieldValue, null, fieldValue.getPage(), readResults)) .collect(Collectors.toList()); @@ -388,10 +364,10 @@ private static FormPage getFormPage(ReadResult readResultItem, List p * * @return The fields populated on {@link RecognizedForm#getFields() fields}. */ - private static Map getLabeledFieldMap(boolean includeFieldElements, + private static Map> getLabeledFieldMap(boolean includeFieldElements, List readResults, PageResult pageResultItem, Integer pageNumber) { - Map formFieldMap = new TreeMap<>(); + Map> formFieldMap = new TreeMap<>(); List keyValuePairs = pageResultItem.getKeyValuePairs(); forEachWithIndex(keyValuePairs, ((index, keyValuePair) -> { List formKeyContentList = null; @@ -407,10 +383,8 @@ private static Map getLabeledFieldMap(boolean includeFieldEle toBoundingBox(keyValuePair.getValue().getBoundingBox()), pageNumber, formValueContentList); String fieldName = "field-" + index; - FormField formField = new FormField(setDefaultConfidenceValue(keyValuePair.getConfidence()), - labelFieldData, fieldName, - new com.azure.ai.formrecognizer.models.FieldValue(FieldValueType.STRING) - .setFormFieldString(keyValuePair.getValue().getText()), valueText); + FormField formField = new FormField<>(setDefaultConfidenceValue(keyValuePair.getConfidence()), + labelFieldData, fieldName, keyValuePair.getValue().getText(), valueText, FieldValueType.STRING); formFieldMap.put(fieldName, formField); })); return formFieldMap; diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FieldValue.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FieldValue.java deleted file mode 100644 index 688930ce2439..000000000000 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FieldValue.java +++ /dev/null @@ -1,215 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.formrecognizer.models; - -import com.azure.core.annotation.Fluent; - -import java.time.LocalDate; -import java.time.LocalTime; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -/** - * The FieldValue model. - */ -@Fluent -public final class FieldValue { - private final FieldValueType type; - private Map formFieldMap; - private List formFieldList; - private Float formFieldFloat; - private Integer formFieldInteger; - private LocalDate formFieldDate; - private LocalTime formFieldTime; - private String formFieldString; - private String formFieldPhoneNumber; - - /** - * Constructs a FieldValue object - * - * @param type The type of the field. - */ - public FieldValue(final FieldValueType type) { - this.type = type; - } - - /** - * Set the map value of the field. - * - * @param formFieldMap the map value of the field. - * - * @return the FieldValue object itself. - */ - public FieldValue setFormFieldMap(final Map formFieldMap) { - this.formFieldMap = formFieldMap == null ? null : Collections.unmodifiableMap(formFieldMap); - return this; - } - - /** - * Set the list value of the field. - * - * @param formFieldList the list of the field. - * - * @return the FieldValue object itself. - */ - public FieldValue setFormFieldList(final List formFieldList) { - this.formFieldList = formFieldList == null ? null - : Collections.unmodifiableList(formFieldList); - return this; - } - - /** - * Set the float value of the field. - * - * @param formFieldFloat the float value of the field. - * - * @return the FieldValue object itself. - */ - public FieldValue setFormFieldFloat(final Float formFieldFloat) { - this.formFieldFloat = formFieldFloat; - return this; - } - - /** - * Set the integer value of the field. - * - * @param formFieldInteger the integer value of the field. - * - * @return the FieldValue object itself. - */ - public FieldValue setFormFieldInteger(final Integer formFieldInteger) { - this.formFieldInteger = formFieldInteger; - return this; - } - - /** - * Set the date value of the field. - * - * @param formFieldDate the date value of the field. - * - * @return the FieldValue object itself. - */ - public FieldValue setFormFieldDate(final LocalDate formFieldDate) { - this.formFieldDate = formFieldDate; - return this; - } - - /** - * Set the time value of the field. - * - * @param formFieldTime the time value of the field. - * - * @return the FieldValue object itself. - */ - public FieldValue setFormFieldTime(final LocalTime formFieldTime) { - this.formFieldTime = formFieldTime; - return this; - } - - /** - * Set the string value of the field. - * - * @param formFieldString the string value of the field. - * - * @return the FieldValue object itself. - */ - public FieldValue setFormFieldString(final String formFieldString) { - this.formFieldString = formFieldString; - return this; - } - - /** - * Set the phone number value of the field. - * - * @param formFieldPhoneNumber the phone number value of the field. - * - * @return the FieldValue object itself. - */ - public FieldValue setFormFieldPhoneNumber(final String formFieldPhoneNumber) { - this.formFieldPhoneNumber = formFieldPhoneNumber; - return this; - } - - /** - * Gets the type of the value of the field. - * - * @return the {@link FieldValueType type} of the field. - */ - public FieldValueType getType() { - return type; - } - - /** - * Gets the value of the field as a {@link String}. - * - * @return the value of the field as a {@link String}. - */ - public String asString() { - return this.formFieldString; - } - - /** - * Gets the value of the field as a {@link Integer}. - * - * @return the value of the field as a {@link Integer}. - */ - public Integer asInteger() { - return this.formFieldInteger; - } - - /** - * Gets the value of the field as a {@link Float}. - * - * @return the value of the field as a {@link Float}. - */ - public Float asFloat() { - return this.formFieldFloat; - } - - /** - * Gets the value of the field as a {@link LocalDate}. - * - * @return the value of the field as a {@link LocalDate}. - */ - public LocalDate asDate() { - return this.formFieldDate; - } - - /** - * Gets the value of the field as a {@link LocalTime}. - * - * @return the value of the field as a {@link LocalTime}. - */ - public LocalTime asTime() { - return this.formFieldTime; - } - - /** - * Gets the value of the field as a phone number. - * - * @return the value of the field as a phone number. - */ - public String asPhoneNumber() { - return this.formFieldPhoneNumber; - } - - /** - * Gets the value of the field as a {@link List}. - * - * @return the value of the field as an unmodifiable {@link List}. - */ - public List asList() { - return this.formFieldList; - } - - /** - * Gets the value of the field as a {@link Map}. - * - * @return the value of the field as an unmodifiable {@link Map}. - */ - public Map asMap() { - return this.formFieldMap; - } -} diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FieldValueType.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FieldValueType.java index 93e5f7dda8b0..975c61ae89c4 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FieldValueType.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FieldValueType.java @@ -3,62 +3,179 @@ package com.azure.ai.formrecognizer.models; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import com.azure.core.util.logging.ClientLogger; -/** Defines values for FieldValueType. */ +import java.time.LocalDate; +import java.time.LocalTime; +import java.time.format.DateTimeFormatter; +import java.util.Objects; + +/** + * Define enum values for FieldValue types. + */ +@SuppressWarnings("unchecked") public enum FieldValueType { - /** Enum value string. */ - STRING("string"), + /** + * Static value string for FieldValueType. + */ + STRING { + @Override + public T cast(FormField formField) { + if (isFieldValueNull(formField)) { + return null; + } + return (T) String.valueOf(formField.getValue()); + } + }, - /** Enum value date. */ - DATE("date"), + /** + * Static value date for FieldValueType. + */ + DATE { + @Override + public T cast(FormField formField) { + if (isFieldValueNull(formField)) { + return null; + } + if (this == formField.getValueType()) { + return (T) formField.getValue(); + } else if (STRING == formField.getValueType()) { + return (T) LocalDate.parse(formField.getValue().toString(), DateTimeFormatter.ofPattern("yyyy/MM/dd")); + } else { + throw LOGGER.logExceptionAsError(new UnsupportedOperationException(String.format("Cannot cast from " + + "field value of type %s to type %s", formField.getValueType(), DATE))); + } + } + }, - /** Enum value time. */ - TIME("time"), + /** + * Static value time for FieldValueType. + */ + TIME { + @Override + public T cast(FormField formField) { + if (isFieldValueNull(formField)) { + return null; + } + if (this == formField.getValueType()) { + return (T) formField.getValue(); + } else if (STRING == formField.getValueType()) { + return (T) LocalTime.parse(formField.getValue().toString(), DateTimeFormatter.ofPattern("HH:mm:ss")); + } else { + throw LOGGER.logExceptionAsError(new UnsupportedOperationException(String.format("Cannot cast from " + + "field value of type %s to type %s", formField.getValueType(), TIME))); + } + } + }, - /** Enum value phoneNumber. */ - PHONE_NUMBER("phoneNumber"), + /** + * Static value phone number for FieldValueType. + */ + PHONE_NUMBER { + @Override + public T cast(FormField formField) { + if (isFieldValueNull(formField)) { + return null; + } + if (this == formField.getValueType()) { + return (T) formField.getValue(); + } else if (STRING == formField.getValueType()) { + return (T) formField.getValue(); + } else { + throw LOGGER.logExceptionAsError(new UnsupportedOperationException(String.format("Cannot cast from " + + "field value of type %s to type %s", formField.getValueType(), PHONE_NUMBER))); + } + } + }, - /** Enum value number. */ - FLOAT("float"), + /** + * Static value double for FieldValueType. + */ + DOUBLE { + @Override + public T cast(FormField formField) { + if (isFieldValueNull(formField)) { + return null; + } + if (this == formField.getValueType()) { + return (T) formField.getValue(); + } else if (STRING == formField.getValueType()) { + return (T) Double.valueOf(formField.getValue().toString()); + } else { + throw LOGGER.logExceptionAsError(new UnsupportedOperationException(String.format("Cannot cast from " + + "field value of type %s to type %s", formField.getValueType(), DOUBLE))); + } + } + }, - /** Enum value integer. */ - INTEGER("integer"), + /** + * Static value long for FieldValueType. + */ + LONG { + @Override + public T cast(FormField formField) { + if (isFieldValueNull(formField)) { + return null; + } + if (this == formField.getValueType()) { + return (T) formField.getValue(); + } else if (STRING == formField.getValueType()) { + return (T) Long.valueOf(formField.getValue().toString()); + } else { + throw LOGGER.logExceptionAsError(new UnsupportedOperationException(String.format("Cannot cast from " + + "field value of type %s to type %s", formField.getValueType(), LONG))); + } + } + }, - /** Enum value array. */ - LIST("list"), + /** + * Static value list for FieldValueType. + */ + LIST { + @Override + public T cast(FormField formField) { + return getCollectionTypeCast(formField); + } + }, - /** Enum value object. */ - MAP("map"); + /** + * Static value map for FieldValueType. + */ + MAP { + @Override + public T cast(FormField formField) { + return getCollectionTypeCast(formField); + } + }; - /** The actual serialized value for a FieldValueType instance. */ - private final String value; + static boolean isFieldValueNull(FormField formField) { + Objects.requireNonNull(formField, "'formField' cannot be null"); + return formField.getValue() == null; + } - FieldValueType(String value) { - this.value = value; + T getCollectionTypeCast(FormField formField) { + if (isFieldValueNull(formField)) { + return null; + } + if (this == formField.getValueType()) { + return (T) formField.getValue(); + } else { + throw LOGGER.logExceptionAsError(new UnsupportedOperationException(String.format("Cannot cast from " + + "field value of type %s to type %s", formField.getValueType(), this))); + } } + private static final ClientLogger LOGGER = new ClientLogger(FieldValueType.class); + /** - * Parses a serialized value to a FieldValueType instance. + * Converts the form field value to a specific enum type. + * + * @param formField The recognized field value that needs to be converted. + * @param the class of the field. * - * @param value the serialized value to parse. - * @return the parsed FieldValueType object, or null if unable to parse. + * @return the converted value of the recognized field. + * @throws UnsupportedOperationException if the {@code formField} type does not match the casting value type. + * @throws NullPointerException if {@code formField} is {@code null} */ - @JsonCreator - public static FieldValueType fromString(String value) { - FieldValueType[] items = FieldValueType.values(); - for (FieldValueType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } + public abstract T cast(FormField formField); } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormField.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormField.java index 036bfbef2db2..6eef6b191256 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormField.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormField.java @@ -9,13 +9,14 @@ * The FormField model. */ @Immutable -public final class FormField { +public final class FormField { private final float confidence; private final FieldData labelData; private final String name; - private final FieldValue fieldValue; private final FieldData valueData; + private final T value; + private final FieldValueType valueType; /** * Constructs a FormField object. @@ -23,16 +24,18 @@ public final class FormField { * @param confidence The confidence of the recognized field. * @param labelData The text, bounding box, and field elements for the field label. * @param name The name the field or label. - * @param fieldValue The value of the recognized field. + * @param value The value of the recognized field. * @param valueData The text, bounding box, and field elements for the field value. + * @param valueType The type of the value of the recognized field. */ - public FormField(final float confidence, final FieldData labelData, final String name, final FieldValue fieldValue, - final FieldData valueData) { + public FormField(final float confidence, final FieldData labelData, final String name, final T value, + final FieldData valueData, FieldValueType valueType) { this.confidence = confidence; this.labelData = labelData; this.name = name; - this.fieldValue = fieldValue; + this.value = value; this.valueData = valueData; + this.valueType = valueType; } /** @@ -65,14 +68,25 @@ public String getName() { /** * Get the value of the recognized field. * - * @return Value of the recognized field. + * @return the value of the recognized field. */ - public FieldValue getFieldValue() { - return this.fieldValue; + public T getValue() { + return this.value; } /** - * Get the text, bounding box, and field elements for the field value. + * The type of the value of the recognized field. + * Possible types include: 'String', + * 'LocalDate', 'LocalTime', 'Long', 'Double', 'Map', or 'List'. + * + * @return the type of the value of the field. + */ + public FieldValueType getValueType() { + return valueType; + } + + /** + * Get the text, bounding box, and text content of the field value. * * @return the text, bounding box, and field elements for the field value. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizedForm.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizedForm.java index 5a8c11011ca7..9b775763a9f4 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizedForm.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizedForm.java @@ -20,7 +20,7 @@ public final class RecognizedForm { * For models trained with labels, this is the training-time label of the field. For models trained with forms * only, a unique name is generated for each field. */ - private final Map fields; + private final Map> fields; /* * Form type. @@ -45,7 +45,7 @@ public final class RecognizedForm { * @param formPageRange First and last page number where the document is found. * @param pages List of extracted pages from the form. */ - public RecognizedForm(final Map fields, final String formType, + public RecognizedForm(final Map> fields, final String formType, final FormPageRange formPageRange, final List pages) { this.fields = fields == null ? null : Collections.unmodifiableMap(fields); this.formType = formType; @@ -60,7 +60,7 @@ public RecognizedForm(final Map fields, final String formType * * @return the unmodifiable map of recognized fields. */ - public Map getFields() { + public Map> getFields() { return this.fields; } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizedReceipt.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizedReceipt.java deleted file mode 100644 index 2f16596dfaca..000000000000 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizedReceipt.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.formrecognizer.models; - -import com.azure.core.annotation.Immutable; - -/** - * The RecognizedReceipt model. - */ -@Immutable -public class RecognizedReceipt { - - /** - * The recognized form. - */ - private final RecognizedForm recognizedForm; - - /** - * Constructs a RecognizedReceipt object. - * - * @param recognizedForm The recognized form. - */ - public RecognizedReceipt(final RecognizedForm recognizedForm) { - this.recognizedForm = recognizedForm; - } - - /** - * Get the extracted field information form for the provided document. - * - * @return The extracted field information form for the provided document. - */ - public RecognizedForm getRecognizedForm() { - return this.recognizedForm; - } -} diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/AdvancedDiffLabeledUnlabeledData.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/AdvancedDiffLabeledUnlabeledData.java index e380fce535a9..b3a96dd6c895 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/AdvancedDiffLabeledUnlabeledData.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/AdvancedDiffLabeledUnlabeledData.java @@ -78,7 +78,7 @@ public static void main(String[] args) throws IOException { } System.out.printf("Field %s has value %s based on %s within bounding box %s with a confidence score " + "of %.2f.%n", - label, formField.getFieldValue(), formField.getValueData().getText(), boundingBoxStr, + label, formField.getValue(), formField.getValueData().getText(), boundingBoxStr, formField.getConfidence()); // Find the value of a specific labeled field. @@ -120,7 +120,7 @@ public static void main(String[] args) throws IOException { System.out.printf("Field %s has value %s based on %s within bounding box %s with a confidence score " + "of %.2f.%n", - label, formField.getFieldValue(), formField.getValueData().getText(), boundingBoxStr, + label, formField.getValue(), formField.getValueData().getText(), boundingBoxStr, formField.getConfidence()); // Find the value of a specific unlabeled field. The specific key "Vendor Name:" provided in the example diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/AdvancedDiffLabeledUnlabeledDataAsync.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/AdvancedDiffLabeledUnlabeledDataAsync.java index f5e14b616707..24b783a515d1 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/AdvancedDiffLabeledUnlabeledDataAsync.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/AdvancedDiffLabeledUnlabeledDataAsync.java @@ -108,7 +108,7 @@ public static void main(String[] args) throws IOException { } System.out.printf("Field %s has value %s based on %s within bounding box %s with a confidence score " + "of %.2f.%n", - label, formField.getFieldValue(), formField.getValueData().getText(), boundingBoxStr, + label, formField.getValue(), formField.getValueData().getText(), boundingBoxStr, formField.getConfidence()); // Find the value of a specific labeled field. @@ -157,7 +157,7 @@ public static void main(String[] args) throws IOException { System.out.printf("Field %s has value %s based on %s within bounding box %s with a confidence " + "score of %.2f.%n", - label, formField.getFieldValue(), formField.getValueData().getText(), boundingBoxStr, + label, formField.getValue(), formField.getValueData().getText(), boundingBoxStr, formField.getConfidence()); // Find the value of a specific unlabeled field. The specific key "Vendor Name:" provided in the diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/Authentication.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/Authentication.java index a8ddc6396270..121fa1b04037 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/Authentication.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/Authentication.java @@ -7,21 +7,21 @@ import com.azure.ai.formrecognizer.models.FieldValueType; import com.azure.ai.formrecognizer.models.FormField; import com.azure.ai.formrecognizer.models.OperationResult; -import com.azure.ai.formrecognizer.models.RecognizedReceipt; +import com.azure.ai.formrecognizer.models.RecognizedForm; import com.azure.ai.formrecognizer.training.FormTrainingClient; import com.azure.ai.formrecognizer.training.FormTrainingClientBuilder; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.util.polling.SyncPoller; import com.azure.identity.DefaultAzureCredentialBuilder; -import java.io.IOException; +import java.time.LocalDate; import java.util.List; import java.util.Map; /** * Samples for two supported methods of authentication in Form Recognizer and Form Training clients: - * 1) Use a Form Recognizer API key with AzureKeyCredential from azure.core.credentials - * 2) Use a token credential from azure-identity to authenticate with Azure Active Directory + * 1) Use a Form Recognizer API key with AzureKeyCredential from azure.core.credentials + * 2) Use a token credential from azure-identity to authenticate with Azure Active Directory */ public class Authentication { /** @@ -29,16 +29,15 @@ public class Authentication { * * @param args Unused arguments to the program. * - * @throws IOException Exception thrown when there is an error in reading all the bytes from the File. */ public static void main(String[] args) { - /* - Set the environment variables with your own values before running the sample: + /** + * Set the environment variables with your own values before running the sample: + * AZURE_CLIENT_ID - the client ID of your active directory application. + * AZURE_TENANT_ID - the tenant ID of your active directory application. + * AZURE_CLIENT_SECRET - the secret of your active directory application. + */ - 1) AZURE_CLIENT_ID - the client ID of your active directory application. - 2) AZURE_TENANT_ID - the tenant ID of your active directory application. - 3) AZURE_CLIENT_SECRET - the secret of your active directory application. - */ // Form recognizer client: Key credential authenticationWithKeyCredentialFormRecognizerClient(); // Form recognizer client: Azure Active Directory @@ -82,52 +81,72 @@ private static void authenticationWithAzureActiveDirectoryFormTrainingClient() { } private static void beginRecognizeCustomFormsFromUrl(FormRecognizerClient formRecognizerClient) { - String receiptUrl = "https://raw.githubusercontent.com/Azure/azure-sdk-for-java/master/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/sample-forms/receipts/contoso-allinone.jpg"; + String receiptUrl = "https://raw.githubusercontent.com/Azure/azure-sdk-for-java/master/sdk/formrecognizer" + + "/azure-ai-formrecognizer/src/samples/java/sample-forms/receipts/contoso-allinone.jpg"; - SyncPoller> recognizeReceiptPoller = + SyncPoller> recognizeReceiptPoller = formRecognizerClient.beginRecognizeReceiptsFromUrl(receiptUrl); - List receiptPageResults = recognizeReceiptPoller.getFinalResult(); + List receiptPageResults = recognizeReceiptPoller.getFinalResult(); for (int i = 0; i < receiptPageResults.size(); i++) { - RecognizedReceipt recognizedReceipt = receiptPageResults.get(i); - Map recognizedFields = recognizedReceipt.getRecognizedForm().getFields(); + RecognizedForm recognizedForm = receiptPageResults.get(i); + Map> recognizedFields = recognizedForm.getFields(); System.out.printf("----------- Recognized Receipt page %d -----------%n", i); - FormField merchantNameField = recognizedFields.get("MerchantName"); - if (merchantNameField.getFieldValue().getType() == FieldValueType.STRING) { - System.out.printf("Merchant Name: %s, confidence: %.2f%n", - merchantNameField.getFieldValue().asString(), - merchantNameField.getConfidence()); + FormField merchantNameField = recognizedFields.get("MerchantName"); + if (merchantNameField != null) { + if (FieldValueType.STRING.equals(merchantNameField.getValueType())) { + String merchantName = FieldValueType.STRING.cast(merchantNameField); + System.out.printf("Merchant Name: %s, confidence: %.2f%n", + merchantName, merchantNameField.getConfidence()); + } } - FormField transactionDateField = recognizedFields.get("TransactionDate"); - if (transactionDateField.getFieldValue().getType() == FieldValueType.DATE) { - System.out.printf("Transaction Date: %s, confidence: %.2f%n", - transactionDateField.getFieldValue().asDate(), - transactionDateField.getConfidence()); + + FormField merchantPhoneNumberField = recognizedFields.get("MerchantPhoneNumber"); + if (merchantPhoneNumberField != null) { + if (FieldValueType.PHONE_NUMBER.equals(merchantNameField.getValueType())) { + String merchantAddress = FieldValueType.PHONE_NUMBER.cast(merchantPhoneNumberField); + System.out.printf("Merchant Phone number: %s, confidence: %.2f%n", + merchantAddress, merchantPhoneNumberField.getConfidence()); + } + } + + FormField transactionDateField = recognizedFields.get("TransactionDate"); + if (transactionDateField != null) { + if (FieldValueType.DATE.equals(transactionDateField.getValueType())) { + LocalDate transactionDate = FieldValueType.DATE.cast(transactionDateField); + System.out.printf("Transaction Date: %s, confidence: %.2f%n", + transactionDate, transactionDateField.getConfidence()); + } } - FormField receiptItemsField = recognizedFields.get("Items"); - System.out.printf("Receipt Items: %n"); - if (receiptItemsField.getFieldValue().getType() == FieldValueType.LIST) { - List receiptItems = receiptItemsField.getFieldValue().asList(); - receiptItems.forEach(receiptItem -> { - if (receiptItem.getFieldValue().getType() == FieldValueType.MAP) { - receiptItem.getFieldValue().asMap().forEach((key, formField) -> { - if (key.equals("Name")) { - if (formField.getFieldValue().getType() == FieldValueType.STRING) { - System.out.printf("Name: %s, confidence: %.2fs%n", - formField.getFieldValue().asString(), - formField.getConfidence()); + + FormField receiptItemsField = recognizedFields.get("Items"); + if (receiptItemsField != null) { + System.out.printf("Receipt Items: %n"); + if (FieldValueType.LIST.equals(receiptItemsField.getValueType())) { + List> receiptItems = FieldValueType.LIST.cast(receiptItemsField); + receiptItems.forEach(receiptItem -> { + if (FieldValueType.MAP.equals(receiptItem.getValueType())) { + Map> formFieldMap = FieldValueType.MAP.cast(receiptItem); + formFieldMap.forEach((key, formField) -> { + if ("Name".equals(key)) { + if (FieldValueType.STRING.equals(formField.getValueType())) { + String name = FieldValueType.STRING.cast(formField); + System.out.printf("Name: %s, confidence: %.2fs%n", + name, formField.getConfidence()); + } } - } - if (key.equals("Quantity")) { - if (formField.getFieldValue().getType() == FieldValueType.INTEGER) { - System.out.printf("Quantity: %s, confidence: %.2f%n", - formField.getFieldValue().asInteger(), formField.getConfidence()); + if ("Quantity".equals(key)) { + if (FieldValueType.DOUBLE.equals(formField.getValueType())) { + Float quantity = FieldValueType.DOUBLE.cast(formField); + System.out.printf("Quantity: %f, confidence: %.2f%n", + quantity, formField.getConfidence()); + } } - } - }); - } - }); + }); + } + }); + } } System.out.print("-----------------------------------"); } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/FormRecognizerAsyncClientJavaDocCodeSnippets.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/FormRecognizerAsyncClientJavaDocCodeSnippets.java index ab23ef74d3c2..3ac36fa32243 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/FormRecognizerAsyncClientJavaDocCodeSnippets.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/FormRecognizerAsyncClientJavaDocCodeSnippets.java @@ -7,7 +7,7 @@ import com.azure.ai.formrecognizer.models.FormContentType; import com.azure.ai.formrecognizer.models.FormField; import com.azure.ai.formrecognizer.models.RecognizeOptions; -import com.azure.ai.formrecognizer.models.RecognizedReceipt; +import com.azure.ai.formrecognizer.models.RecognizedForm; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; @@ -19,6 +19,7 @@ import java.nio.ByteBuffer; import java.nio.file.Files; import java.time.Duration; +import java.time.LocalDate; import java.util.List; import java.util.Map; @@ -76,7 +77,7 @@ public void beginRecognizeCustomFormsFromUrl() { recognizedForms.forEach(recognizedForm -> { recognizedForm.getFields().forEach((fieldText, fieldValue) -> { System.out.printf("Field text: %s%n", fieldText); - System.out.printf("Field value: %s%n", fieldValue.getFieldValue()); + System.out.printf("Field value: %s%n", fieldValue.getValue()); System.out.printf("Confidence score: %.2f%n", fieldValue.getConfidence()); }); })); @@ -103,7 +104,7 @@ public void beginRecognizeCustomFormsFromUrlWithOptions() { recognizedForms.forEach(recognizedForm -> { recognizedForm.getFields().forEach((fieldText, fieldValue) -> { System.out.printf("Field text: %s%n", fieldText); - System.out.printf("Field value: %s%n", fieldValue.getFieldValue()); + System.out.printf("Field value: %s%n", fieldValue.getValue()); System.out.printf("Confidence score: %.2f%n", fieldValue.getConfidence()); }); })); @@ -129,7 +130,7 @@ public void beginRecognizeCustomForms() throws IOException { recognizedForms.forEach(recognizedForm -> { recognizedForm.getFields().forEach((fieldText, fieldValue) -> { System.out.printf("Field text: %s%n", fieldText); - System.out.printf("Field value: %s%n", fieldValue.getFieldValue()); + System.out.printf("Field value: %s%n", fieldValue.getValue()); System.out.printf("Confidence score: %.2f%n", fieldValue.getConfidence()); }); })); @@ -162,7 +163,7 @@ public void beginRecognizeCustomFormsWithOptions() throws IOException { recognizedForms.forEach(recognizedForm -> { recognizedForm.getFields().forEach((fieldText, fieldValue) -> { System.out.printf("Field text: %s%n", fieldText); - System.out.printf("Field value: %s%n", fieldValue.getFieldValue()); + System.out.printf("Field value: %s%n", fieldValue.getValue()); System.out.printf("Confidence score: %.2f%n", fieldValue.getConfidence()); }); })); @@ -289,37 +290,57 @@ public void beginRecognizeReceiptsFromUrl() { recognizePollingOperation.getFinalResult()) .subscribe(recognizedReceipts -> { for (int i = 0; i < recognizedReceipts.size(); i++) { - RecognizedReceipt recognizedReceipt = recognizedReceipts.get(i); - Map recognizedFields = recognizedReceipt.getRecognizedForm().getFields(); + RecognizedForm recognizedForm = recognizedReceipts.get(i); + Map> recognizedFields = recognizedForm.getFields(); System.out.printf("----------- Recognized Receipt page %d -----------%n", i); - FormField merchantNameField = recognizedFields.get("MerchantName"); - if (merchantNameField.getFieldValue().getType() == FieldValueType.STRING) { - System.out.printf("Merchant Name: %s, confidence: %.2f%n", - merchantNameField.getFieldValue().asString(), - merchantNameField.getConfidence()); + FormField merchantNameField = recognizedFields.get("MerchantName"); + if (merchantNameField != null) { + if (FieldValueType.STRING.equals(merchantNameField.getValueType())) { + String merchantName = FieldValueType.STRING.cast(merchantNameField); + System.out.printf("Merchant Name: %s, confidence: %.2f%n", + merchantName, merchantNameField.getConfidence()); + } } - FormField transactionDateField = recognizedFields.get("TransactionDate"); - if (transactionDateField.getFieldValue().getType() == FieldValueType.DATE) { - System.out.printf("Transaction Date: %s, confidence: %.2f%n", - transactionDateField.getFieldValue().asDate(), - transactionDateField.getConfidence()); + + FormField merchantPhoneNumberField = recognizedFields.get("MerchantPhoneNumber"); + if (merchantPhoneNumberField != null) { + if (FieldValueType.PHONE_NUMBER.equals(merchantNameField.getValueType())) { + String merchantAddress = FieldValueType.PHONE_NUMBER.cast(merchantPhoneNumberField); + System.out.printf("Merchant Phone number: %s, confidence: %.2f%n", + merchantAddress, merchantPhoneNumberField.getConfidence()); + } + } + + FormField transactionDateField = recognizedFields.get("TransactionDate"); + if (transactionDateField != null) { + if (FieldValueType.DATE.equals(transactionDateField.getValueType())) { + LocalDate transactionDate = FieldValueType.DATE.cast(transactionDateField); + System.out.printf("Transaction Date: %s, confidence: %.2f%n", + transactionDate, transactionDateField.getConfidence()); + } } - FormField receiptItemsField = recognizedFields.get("Items"); - System.out.printf("Receipt Items: %n"); - if (receiptItemsField.getFieldValue().getType() == FieldValueType.LIST) { - List receiptItems = receiptItemsField.getFieldValue().asList(); - receiptItems.forEach(receiptItem -> { - if (receiptItem.getFieldValue().getType() == FieldValueType.MAP) { - receiptItem.getFieldValue().asMap().forEach((key, formField) -> { - if (key.equals("Quantity")) { - if (formField.getFieldValue().getType() == FieldValueType.INTEGER) { - System.out.printf("Quantity: %s, confidence: %.2f%n", - formField.getFieldValue().asInteger(), formField.getConfidence()); + + FormField receiptItemsField = recognizedFields.get("Items"); + if (receiptItemsField != null) { + System.out.printf("Receipt Items: %n"); + if (FieldValueType.LIST.equals(receiptItemsField.getValueType())) { + List> receiptItems = FieldValueType.LIST.cast(receiptItemsField); + receiptItems.forEach(receiptItem -> { + if (FieldValueType.MAP.equals(receiptItem.getValueType())) { + + Map> formFieldMap = FieldValueType.MAP.cast(receiptItem); + formFieldMap.forEach((key, formField) -> { + if ("Quantity".equals(key)) { + if (FieldValueType.DOUBLE.equals(formField.getValueType())) { + Float quantity = FieldValueType.DOUBLE.cast(formField); + System.out.printf("Quantity: %f, confidence: %.2f%n", + quantity, formField.getConfidence()); + } } - } - }); - } - }); + }); + } + }); + } } } }); @@ -342,37 +363,57 @@ public void beginRecognizeReceiptsFromUrlWithOptions() { recognizePollingOperation.getFinalResult()) .subscribe(recognizedReceipts -> { for (int i = 0; i < recognizedReceipts.size(); i++) { - RecognizedReceipt recognizedReceipt = recognizedReceipts.get(i); - Map recognizedFields = recognizedReceipt.getRecognizedForm().getFields(); - System.out.printf("----------- Recognized Receipt page %s -----------%n", i); - FormField merchantNameField = recognizedFields.get("MerchantName"); - if (merchantNameField.getFieldValue().getType() == FieldValueType.STRING) { - System.out.printf("Merchant Name: %s, confidence: %.2f%n", - merchantNameField.getFieldValue().asString(), - merchantNameField.getConfidence()); + RecognizedForm recognizedReceipt = recognizedReceipts.get(i); + Map> recognizedFields = recognizedReceipt.getFields(); + System.out.printf("----------- Recognized Receipt page %d -----------%n", i); + FormField merchantNameField = recognizedFields.get("MerchantName"); + if (merchantNameField != null) { + if (FieldValueType.STRING.equals(merchantNameField.getValueType())) { + String merchantName = FieldValueType.STRING.cast(merchantNameField); + System.out.printf("Merchant Name: %s, confidence: %.2f%n", + merchantName, merchantNameField.getConfidence()); + } } - FormField transactionDateField = recognizedFields.get("TransactionDate"); - if (transactionDateField.getFieldValue().getType() == FieldValueType.DATE) { - System.out.printf("Transaction Date: %s, confidence: %.2f%n", - transactionDateField.getFieldValue().asDate(), - transactionDateField.getConfidence()); + + FormField merchantPhoneNumberField = recognizedFields.get("MerchantPhoneNumber"); + if (merchantPhoneNumberField != null) { + if (FieldValueType.PHONE_NUMBER.equals(merchantNameField.getValueType())) { + String merchantAddress = FieldValueType.PHONE_NUMBER.cast(merchantPhoneNumberField); + System.out.printf("Merchant Phone number: %s, confidence: %.2f%n", + merchantAddress, merchantPhoneNumberField.getConfidence()); + } } - FormField receiptItemsField = recognizedFields.get("Items"); - System.out.printf("Receipt Items: %n"); - if (receiptItemsField.getFieldValue().getType() == FieldValueType.LIST) { - List receiptItems = receiptItemsField.getFieldValue().asList(); - receiptItems.forEach(receiptItem -> { - if (receiptItem.getFieldValue().getType() == FieldValueType.MAP) { - receiptItem.getFieldValue().asMap().forEach((key, formField) -> { - if (key.equals("Quantity")) { - if (formField.getFieldValue().getType() == FieldValueType.INTEGER) { - System.out.printf("Quantity: %s, confidence: %.2f%n", - formField.getFieldValue().asInteger(), formField.getConfidence()); + + FormField transactionDateField = recognizedFields.get("TransactionDate"); + if (transactionDateField != null) { + if (FieldValueType.DATE.equals(transactionDateField.getValueType())) { + LocalDate transactionDate = FieldValueType.DATE.cast(transactionDateField); + System.out.printf("Transaction Date: %s, confidence: %.2f%n", + transactionDate, transactionDateField.getConfidence()); + } + } + + FormField receiptItemsField = recognizedFields.get("Items"); + if (receiptItemsField != null) { + System.out.printf("Receipt Items: %n"); + if (FieldValueType.LIST.equals(receiptItemsField.getValueType())) { + List> receiptItems = FieldValueType.LIST.cast(receiptItemsField); + receiptItems.forEach(receiptItem -> { + if (FieldValueType.MAP.equals(receiptItem.getValueType())) { + + Map> formFieldMap = FieldValueType.MAP.cast(receiptItem); + formFieldMap.forEach((key, formField) -> { + if ("Quantity".equals(key)) { + if (FieldValueType.DOUBLE.equals(formField.getValueType())) { + Float quantity = FieldValueType.DOUBLE.cast(formField); + System.out.printf("Quantity: %f, confidence: %.2f%n", + quantity, formField.getConfidence()); + } } - } - }); - } - }); + }); + } + }); + } } } }); @@ -389,45 +430,64 @@ public void beginRecognizeReceipts() throws IOException { File receipt = new File("{file_source_url}"); Flux buffer = toFluxByteBuffer(new ByteArrayInputStream(Files.readAllBytes(receipt.toPath()))); formRecognizerAsyncClient.beginRecognizeReceipts(buffer, receipt.length()) - .flatMap(recognizePollingOperation -> + .subscribe(recognizePollingOperation -> // if training polling operation completed, retrieve the final result. - recognizePollingOperation.getFinalResult()) - .subscribe(recognizedReceipts -> { - for (int i = 0; i < recognizedReceipts.size(); i++) { - RecognizedReceipt recognizedReceipt = recognizedReceipts.get(i); - Map recognizedFields = recognizedReceipt.getRecognizedForm().getFields(); - System.out.printf("----------- Recognized Receipt page %s -----------%n", i); - FormField merchantNameField = recognizedFields.get("MerchantName"); - if (merchantNameField.getFieldValue().getType() == FieldValueType.STRING) { - System.out.printf("Merchant Name: %s, confidence: %.2f%n", - merchantNameField.getFieldValue().asString(), - merchantNameField.getConfidence()); - } - FormField transactionDateField = recognizedFields.get("TransactionDate"); - if (transactionDateField.getFieldValue().getType() == FieldValueType.DATE) { - System.out.printf("Transaction Date: %s, confidence: %.2f%n", - transactionDateField.getFieldValue().asDate(), - transactionDateField.getConfidence()); - } - FormField receiptItemsField = recognizedFields.get("Items"); - System.out.printf("Receipt Items: %n"); - if (receiptItemsField.getFieldValue().getType() == FieldValueType.LIST) { - List receiptItems = receiptItemsField.getFieldValue().asList(); - receiptItems.forEach(receiptItem -> { - if (receiptItem.getFieldValue().getType() == FieldValueType.MAP) { - receiptItem.getFieldValue().asMap().forEach((key, formField) -> { - if (key.equals("Quantity")) { - if (formField.getFieldValue().getType() == FieldValueType.INTEGER) { - System.out.printf("Quantity: %s, confidence: %.2f%n", - formField.getFieldValue().asInteger(), formField.getConfidence()); - } + recognizePollingOperation.getFinalResult().subscribe(recognizedReceipts -> { + for (int i = 0; i < recognizedReceipts.size(); i++) { + RecognizedForm recognizedForm = recognizedReceipts.get(i); + Map> recognizedFields = recognizedForm.getFields(); + System.out.printf("----------- Recognized Receipt page %d -----------%n", i); + FormField merchantNameField = recognizedFields.get("MerchantName"); + if (merchantNameField != null) { + if (FieldValueType.STRING.equals(merchantNameField.getValueType())) { + String merchantName = FieldValueType.STRING.cast(merchantNameField); + System.out.printf("Merchant Name: %s, confidence: %.2f%n", + merchantName, merchantNameField.getConfidence()); + } + } + + FormField merchantPhoneNumberField = recognizedFields.get("MerchantPhoneNumber"); + if (merchantPhoneNumberField != null) { + if (FieldValueType.PHONE_NUMBER.equals(merchantNameField.getValueType())) { + String merchantAddress = FieldValueType.PHONE_NUMBER.cast(merchantPhoneNumberField); + System.out.printf("Merchant Phone number: %s, confidence: %.2f%n", + merchantAddress, merchantPhoneNumberField.getConfidence()); + } + } + + FormField transactionDateField = recognizedFields.get("TransactionDate"); + if (transactionDateField != null) { + if (FieldValueType.DATE.equals(transactionDateField.getValueType())) { + LocalDate transactionDate = FieldValueType.DATE.cast(transactionDateField); + System.out.printf("Transaction Date: %s, confidence: %.2f%n", + transactionDate, transactionDateField.getConfidence()); + } + } + + FormField receiptItemsField = recognizedFields.get("Items"); + if (receiptItemsField != null) { + System.out.printf("Receipt Items: %n"); + if (FieldValueType.LIST.equals(receiptItemsField.getValueType())) { + List> receiptItems = FieldValueType.LIST.cast(receiptItemsField); + receiptItems.forEach(receiptItem -> { + if (FieldValueType.MAP.equals(receiptItem.getValueType())) { + + Map> formFieldMap = FieldValueType.MAP.cast(receiptItem); + formFieldMap.forEach((key, formField) -> { + if ("Quantity".equals(key)) { + if (FieldValueType.DOUBLE.equals(formField.getValueType())) { + Float quantity = FieldValueType.DOUBLE.cast(formField); + System.out.printf("Quantity: %f, confidence: %.2f%n", + quantity, formField.getConfidence()); + } + } + }); } }); } - }); + } } - } - }); + })); // END: com.azure.ai.formrecognizer.FormRecognizerAsyncClient.beginRecognizeReceipts#Flux-long } @@ -448,45 +508,65 @@ public void beginRecognizeReceiptsWithOptions() throws IOException { .setContentType(FormContentType.IMAGE_JPEG) .setIncludeFieldElements(includeFieldElements) .setPollInterval(Duration.ofSeconds(5))) - .flatMap(recognizePollingOperation -> + .subscribe(recognizePollingOperation -> // if training polling operation completed, retrieve the final result. - recognizePollingOperation.getFinalResult()) - .subscribe(recognizedReceipts -> { - for (int i = 0; i < recognizedReceipts.size(); i++) { - RecognizedReceipt recognizedReceipt = recognizedReceipts.get(i); - Map recognizedFields = recognizedReceipt.getRecognizedForm().getFields(); - System.out.printf("----------- Recognized Receipt page %s -----------%n", i); - FormField merchantNameField = recognizedFields.get("MerchantName"); - if (merchantNameField.getFieldValue().getType() == FieldValueType.STRING) { - System.out.printf("Merchant Name: %s, confidence: %.2f%n", - merchantNameField.getFieldValue().asString(), - merchantNameField.getConfidence()); - } - FormField transactionDateField = recognizedFields.get("TransactionDate"); - if (transactionDateField.getFieldValue().getType() == FieldValueType.DATE) { - System.out.printf("Transaction Date: %s, confidence: %.2f%n", - transactionDateField.getFieldValue().asDate(), - transactionDateField.getConfidence()); - } - FormField receiptItemsField = recognizedFields.get("Items"); - System.out.printf("Receipt Items: %n"); - if (receiptItemsField.getFieldValue().getType() == FieldValueType.LIST) { - List receiptItems = receiptItemsField.getFieldValue().asList(); - receiptItems.forEach(receiptItem -> { - if (receiptItem.getFieldValue().getType() == FieldValueType.MAP) { - receiptItem.getFieldValue().asMap().forEach((key, formField) -> { - if (key.equals("Quantity")) { - if (formField.getFieldValue().getType() == FieldValueType.INTEGER) { - System.out.printf("Quantity: %s, confidence: %.2f%n", - formField.getFieldValue().asInteger(), formField.getConfidence()); - } + recognizePollingOperation.getFinalResult().subscribe(recognizedReceipts -> { + for (int i = 0; i < recognizedReceipts.size(); i++) { + RecognizedForm recognizedForm = recognizedReceipts.get(i); + Map> recognizedFields = recognizedForm.getFields(); + System.out.printf("----------- Recognized Receipt page %d -----------%n", i); + FormField merchantNameField = recognizedFields.get("MerchantName"); + if (merchantNameField != null) { + if (FieldValueType.STRING.equals(merchantNameField.getValueType())) { + String merchantName = FieldValueType.STRING.cast(merchantNameField); + System.out.printf("Merchant Name: %s, confidence: %.2f%n", + merchantName, merchantNameField.getConfidence()); + } + } + + FormField merchantPhoneNumberField = recognizedFields.get("MerchantPhoneNumber"); + if (merchantPhoneNumberField != null) { + if (FieldValueType.PHONE_NUMBER.equals(merchantNameField.getValueType())) { + String merchantAddress = FieldValueType.PHONE_NUMBER.cast(merchantPhoneNumberField); + System.out.printf("Merchant Phone number: %s, confidence: %.2f%n", + merchantAddress, merchantPhoneNumberField.getConfidence()); + } + } + + FormField transactionDateField = recognizedFields.get("TransactionDate"); + if (transactionDateField != null) { + if (FieldValueType.DATE.equals(transactionDateField.getValueType())) { + LocalDate transactionDate = FieldValueType.DATE.cast(transactionDateField); + System.out.printf("Transaction Date: %s, confidence: %.2f%n", + transactionDate, transactionDateField.getConfidence()); + } + } + + FormField receiptItemsField = recognizedFields.get("Items"); + if (receiptItemsField != null) { + System.out.printf("Receipt Items: %n"); + if (FieldValueType.LIST.equals(receiptItemsField.getValueType())) { + List> receiptItems = FieldValueType.LIST.cast(receiptItemsField); + receiptItems.forEach(receiptItem -> { + if (FieldValueType.MAP.equals(receiptItem.getValueType())) { + + Map> formFieldMap = FieldValueType.MAP.cast(receiptItem); + formFieldMap.forEach((key, formField) -> { + if ("Quantity".equals(key)) { + if (FieldValueType.DOUBLE.equals(formField.getValueType())) { + Float quantity = FieldValueType.DOUBLE.cast(formField); + System.out.printf("Quantity: %f, confidence: %.2f%n", + quantity, formField.getConfidence()); + } + } + }); } }); } - }); + } } - } - }); + })); + // END: com.azure.ai.formrecognizer.FormRecognizerAsyncClient.beginRecognizeReceipts#Flux-long-recognizeOptions } } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/FormRecognizerClientJavaDocCodeSnippets.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/FormRecognizerClientJavaDocCodeSnippets.java index f1aa02207094..3e88ff23d154 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/FormRecognizerClientJavaDocCodeSnippets.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/FormRecognizerClientJavaDocCodeSnippets.java @@ -17,6 +17,7 @@ import java.io.InputStream; import java.nio.file.Files; import java.time.Duration; +import java.time.LocalDate; import java.util.List; import java.util.Map; @@ -67,13 +68,12 @@ public void beginRecognizeCustomFormsFromUrl() { String modelId = "{custom_trained_model_id}"; formRecognizerClient.beginRecognizeCustomFormsFromUrl(formUrl, modelId).getFinalResult() - .forEach(recognizedForm -> { + .forEach(recognizedForm -> recognizedForm.getFields().forEach((fieldText, fieldValue) -> { System.out.printf("Field text: %s%n", fieldText); - System.out.printf("Field value: %s%n", fieldValue.getFieldValue()); + System.out.printf("Field value: %s%n", fieldValue.getValue()); System.out.printf("Confidence score: %.2f%n", fieldValue.getConfidence()); - }); - }); + })); // END: com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeCustomFormsFromUrl#string-string } @@ -94,7 +94,7 @@ public void beginRecognizeCustomFormsFromUrlWithOptions() { .getFinalResult() .forEach(recognizedForm -> recognizedForm.getFields().forEach((fieldText, fieldValue) -> { System.out.printf("Field text: %s%n", fieldText); - System.out.printf("Field value: %s%n", fieldValue.getFieldValue()); + System.out.printf("Field value: %s%n", fieldValue.getValue()); System.out.printf("Confidence score: %.2f%n", fieldValue.getConfidence()); })); // END: com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeCustomFormsFromUrl#string-string-recognizeOptions @@ -116,7 +116,7 @@ public void beginRecognizeCustomForms() throws IOException { formRecognizerClient.beginRecognizeCustomForms(targetStream, form.length(), modelId).getFinalResult() .forEach(recognizedForm -> recognizedForm.getFields().forEach((fieldText, fieldValue) -> { System.out.printf("Field text: %s%n", fieldText); - System.out.printf("Field value: %s%n", fieldValue.getFieldValue()); + System.out.printf("Field value: %s%n", fieldValue.getValue()); System.out.printf("Confidence score: %.2f%n", fieldValue.getConfidence()); })); // END: com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeCustomForms#InputStream-long-string @@ -145,7 +145,7 @@ public void beginRecognizeCustomFormsWithOptions() throws IOException { .getFinalResult() .forEach(recognizedForm -> recognizedForm.getFields().forEach((fieldText, fieldValue) -> { System.out.printf("Field text: %s%n", fieldText); - System.out.printf("Field value: %s%n", fieldValue.getFieldValue()); + System.out.printf("Field value: %s%n", fieldValue.getValue()); System.out.printf("Confidence score: %.2f%n", fieldValue.getConfidence()); })); // END: com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeCustomForms#InputStream-long-string-recognizeOptions @@ -250,35 +250,54 @@ public void beginRecognizeReceiptsFromUrl() { String receiptUrl = "{file_source_url}"; formRecognizerClient.beginRecognizeReceiptsFromUrl(receiptUrl).getFinalResult() .forEach(recognizedReceipt -> { - Map recognizedFields = recognizedReceipt.getRecognizedForm().getFields(); - FormField merchantNameField = recognizedFields.get("MerchantName"); - if (merchantNameField.getFieldValue().getType() == FieldValueType.STRING) { - System.out.printf("Merchant Name: %s, confidence: %.2f%n", - merchantNameField.getFieldValue().asString(), - merchantNameField.getConfidence()); + Map> recognizedFields = recognizedReceipt.getFields(); + FormField merchantNameField = recognizedFields.get("MerchantName"); + if (merchantNameField != null) { + if (FieldValueType.STRING.equals(merchantNameField.getValueType())) { + String merchantName = FieldValueType.STRING.cast(merchantNameField); + System.out.printf("Merchant Name: %s, confidence: %.2f%n", + merchantName, merchantNameField.getConfidence()); + } } - FormField transactionDateField = recognizedFields.get("TransactionDate"); - if (transactionDateField.getFieldValue().getType() == FieldValueType.DATE) { - System.out.printf("Transaction Date: %s, confidence: %.2f%n", - transactionDateField.getFieldValue().asDate(), - transactionDateField.getConfidence()); + + FormField merchantPhoneNumberField = recognizedFields.get("MerchantPhoneNumber"); + if (merchantPhoneNumberField != null) { + if (FieldValueType.PHONE_NUMBER.equals(merchantNameField.getValueType())) { + String merchantAddress = FieldValueType.PHONE_NUMBER.cast(merchantPhoneNumberField); + System.out.printf("Merchant Phone number: %s, confidence: %.2f%n", + merchantAddress, merchantPhoneNumberField.getConfidence()); + } + } + + FormField transactionDateField = recognizedFields.get("TransactionDate"); + if (transactionDateField != null) { + if (FieldValueType.DATE.equals(transactionDateField.getValueType())) { + LocalDate transactionDate = FieldValueType.DATE.cast(transactionDateField); + System.out.printf("Transaction Date: %s, confidence: %.2f%n", + transactionDate, transactionDateField.getConfidence()); + } } - FormField receiptItemsField = recognizedFields.get("Items"); - System.out.printf("Receipt Items: %n"); - if (receiptItemsField.getFieldValue().getType() == FieldValueType.LIST) { - List receiptItems = receiptItemsField.getFieldValue().asList(); - receiptItems.forEach(receiptItem -> { - if (receiptItem.getFieldValue().getType() == FieldValueType.MAP) { - receiptItem.getFieldValue().asMap().forEach((key, formField) -> { - if (key.equals("Quantity")) { - if (formField.getFieldValue().getType() == FieldValueType.INTEGER) { - System.out.printf("Quantity: %s, confidence: %.2f%n", - formField.getFieldValue().asInteger(), formField.getConfidence()); + + FormField receiptItemsField = recognizedFields.get("Items"); + if (receiptItemsField != null) { + System.out.printf("Receipt Items: %n"); + if (FieldValueType.LIST.equals(receiptItemsField.getValueType())) { + List> receiptItems = FieldValueType.LIST.cast(receiptItemsField); + receiptItems.forEach(receiptItem -> { + if (FieldValueType.MAP.equals(receiptItem.getValueType())) { + Map> formFieldMap = FieldValueType.MAP.cast(receiptItem); + formFieldMap.forEach((key, formField) -> { + if ("Quantity".equals(key)) { + if (FieldValueType.DOUBLE.equals(formField.getValueType())) { + Float quantity = FieldValueType.DOUBLE.cast(formField); + System.out.printf("Quantity: %d, confidence: %.2f%n", + quantity, formField.getConfidence()); + } } - } - }); - } - }); + }); + } + }); + } } }); // END: com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeReceiptsFromUrl#string @@ -289,38 +308,57 @@ public void beginRecognizeReceiptsFromUrl() { */ public void beginRecognizeReceiptsFromUrlWithOptions() { // BEGIN: com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeReceiptsFromUrl#string-recognizeOptions - String receiptUrl = "{file_source_url}"; + String receiptUrl = "{receipt_url}"; formRecognizerClient.beginRecognizeReceiptsFromUrl(receiptUrl).getFinalResult() .forEach(recognizedReceipt -> { - Map recognizedFields = recognizedReceipt.getRecognizedForm().getFields(); - FormField merchantNameField = recognizedFields.get("MerchantName"); - if (merchantNameField.getFieldValue().getType() == FieldValueType.STRING) { - System.out.printf("Merchant Name: %s, confidence: %.2f%n", - merchantNameField.getFieldValue().asString(), - merchantNameField.getConfidence()); + Map> recognizedFields = recognizedReceipt.getFields(); + FormField merchantNameField = recognizedFields.get("MerchantName"); + if (merchantNameField != null) { + if (FieldValueType.STRING.equals(merchantNameField.getValueType())) { + String merchantName = FieldValueType.STRING.cast(merchantNameField); + System.out.printf("Merchant Name: %s, confidence: %.2f%n", + merchantName, merchantNameField.getConfidence()); + } } - FormField transactionDateField = recognizedFields.get("TransactionDate"); - if (transactionDateField.getFieldValue().getType() == FieldValueType.DATE) { - System.out.printf("Transaction Date: %s, confidence: %.2f%n", - transactionDateField.getFieldValue().asDate(), - transactionDateField.getConfidence()); + + FormField merchantPhoneNumberField = recognizedFields.get("MerchantPhoneNumber"); + if (merchantPhoneNumberField != null) { + if (FieldValueType.PHONE_NUMBER.equals(merchantNameField.getValueType())) { + String merchantAddress = FieldValueType.PHONE_NUMBER.cast(merchantPhoneNumberField); + System.out.printf("Merchant Phone number: %s, confidence: %.2f%n", + merchantAddress, merchantPhoneNumberField.getConfidence()); + } + } + + FormField transactionDateField = recognizedFields.get("TransactionDate"); + if (transactionDateField != null) { + if (FieldValueType.DATE.equals(transactionDateField.getValueType())) { + LocalDate transactionDate = FieldValueType.DATE.cast(transactionDateField); + System.out.printf("Transaction Date: %s, confidence: %.2f%n", + transactionDate, transactionDateField.getConfidence()); + } } - FormField receiptItemsField = recognizedFields.get("Items"); - System.out.printf("Receipt Items: %n"); - if (receiptItemsField.getFieldValue().getType() == FieldValueType.LIST) { - List receiptItems = receiptItemsField.getFieldValue().asList(); - receiptItems.forEach(receiptItem -> { - if (receiptItem.getFieldValue().getType() == FieldValueType.MAP) { - receiptItem.getFieldValue().asMap().forEach((key, formField) -> { - if (key.equals("Quantity")) { - if (formField.getFieldValue().getType() == FieldValueType.INTEGER) { - System.out.printf("Quantity: %s, confidence: %.2f%n", - formField.getFieldValue().asInteger(), formField.getConfidence()); + + FormField receiptItemsField = recognizedFields.get("Items"); + if (receiptItemsField != null) { + System.out.printf("Receipt Items: %n"); + if (FieldValueType.LIST.equals(receiptItemsField.getValueType())) { + List> receiptItems = FieldValueType.LIST.cast(receiptItemsField); + receiptItems.forEach(receiptItem -> { + if (FieldValueType.MAP.equals(receiptItem.getValueType())) { + Map> formFieldMap = FieldValueType.MAP.cast(receiptItem); + formFieldMap.forEach((key, formField) -> { + if ("Quantity".equals(key)) { + if (FieldValueType.DOUBLE.equals(formField.getValueType())) { + Float quantity = FieldValueType.DOUBLE.cast(formField); + System.out.printf("Quantity: %d, confidence: %.2f%n", + quantity, formField.getConfidence()); + } } - } - }); - } - }); + }); + } + }); + } } }); // END: com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeReceiptsFromUrl#string-recognizeOptions @@ -333,41 +371,60 @@ public void beginRecognizeReceiptsFromUrlWithOptions() { */ public void beginRecognizeReceipts() throws IOException { // BEGIN: com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeReceipts#InputStream-long - File receipt = new File("{file_source_url}"); + File receipt = new File("{receipt_url}"); byte[] fileContent = Files.readAllBytes(receipt.toPath()); InputStream targetStream = new ByteArrayInputStream(fileContent); formRecognizerClient.beginRecognizeReceipts(targetStream, receipt.length()) .getFinalResult().forEach(recognizedReceipt -> { - Map recognizedFields = recognizedReceipt.getRecognizedForm().getFields(); - FormField merchantNameField = recognizedFields.get("MerchantName"); - if (merchantNameField.getFieldValue().getType() == FieldValueType.STRING) { - System.out.printf("Merchant Name: %s, confidence: %.2f%n", - merchantNameField.getFieldValue().asString(), - merchantNameField.getConfidence()); + Map> recognizedFields = recognizedReceipt.getFields(); + FormField merchantNameField = recognizedFields.get("MerchantName"); + if (merchantNameField != null) { + if (FieldValueType.STRING.equals(merchantNameField.getValueType())) { + String merchantName = FieldValueType.STRING.cast(merchantNameField); + System.out.printf("Merchant Name: %s, confidence: %.2f%n", + merchantName, merchantNameField.getConfidence()); + } } - FormField transactionDateField = recognizedFields.get("TransactionDate"); - if (transactionDateField.getFieldValue().getType() == FieldValueType.DATE) { - System.out.printf("Transaction Date: %s, confidence: %.2f%n", - transactionDateField.getFieldValue().asDate(), - transactionDateField.getConfidence()); + + FormField merchantPhoneNumberField = recognizedFields.get("MerchantPhoneNumber"); + if (merchantPhoneNumberField != null) { + if (FieldValueType.PHONE_NUMBER.equals(merchantNameField.getValueType())) { + String merchantAddress = FieldValueType.PHONE_NUMBER.cast(merchantPhoneNumberField); + System.out.printf("Merchant Phone number: %s, confidence: %.2f%n", + merchantAddress, merchantPhoneNumberField.getConfidence()); + } } - FormField receiptItemsField = recognizedFields.get("Items"); - System.out.printf("Receipt Items: %n"); - if (receiptItemsField.getFieldValue().getType() == FieldValueType.LIST) { - List receiptItems = receiptItemsField.getFieldValue().asList(); - receiptItems.forEach(receiptItem -> { - if (receiptItem.getFieldValue().getType() == FieldValueType.MAP) { - receiptItem.getFieldValue().asMap().forEach((key, formField) -> { - if (key.equals("Quantity")) { - if (formField.getFieldValue().getType() == FieldValueType.INTEGER) { - System.out.printf("Quantity: %d, confidence: %.2f%n", - formField.getFieldValue().asInteger(), formField.getConfidence()); + + FormField transactionDateField = recognizedFields.get("TransactionDate"); + if (transactionDateField != null) { + if (FieldValueType.DATE.equals(transactionDateField.getValueType())) { + LocalDate transactionDate = FieldValueType.DATE.cast(transactionDateField); + System.out.printf("Transaction Date: %s, confidence: %.2f%n", + transactionDate, transactionDateField.getConfidence()); + } + } + + FormField receiptItemsField = recognizedFields.get("Items"); + if (receiptItemsField != null) { + System.out.printf("Receipt Items: %n"); + if (FieldValueType.LIST.equals(receiptItemsField.getValueType())) { + List> receiptItems = FieldValueType.LIST.cast(receiptItemsField); + receiptItems.forEach(receiptItem -> { + if (FieldValueType.MAP.equals(receiptItem.getValueType())) { + Map> formFieldMap = FieldValueType.MAP.cast(receiptItem); + formFieldMap.forEach((key, formField) -> { + if ("Quantity".equals(key)) { + if (FieldValueType.DOUBLE.equals(formField.getValueType())) { + Float quantity = FieldValueType.DOUBLE.cast(formField); + System.out.printf("Quantity: %d, confidence: %.2f%n", + quantity, formField.getConfidence()); + } } - } - }); - } - }); + }); + } + }); + } } }); // END: com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeReceipts#InputStream-long @@ -392,35 +449,54 @@ public void beginRecognizeReceiptsWithOptions() throws IOException { .setIncludeFieldElements(includeFieldElements) .setPollInterval(Duration.ofSeconds(5))) .getFinalResult().forEach(recognizedReceipt -> { - Map recognizedFields = recognizedReceipt.getRecognizedForm().getFields(); - FormField merchantNameField = recognizedFields.get("MerchantName"); - if (merchantNameField.getFieldValue().getType() == FieldValueType.STRING) { - System.out.printf("Merchant Name: %s, confidence: %.2f%n", - merchantNameField.getFieldValue().asString(), - merchantNameField.getConfidence()); + Map> recognizedFields = recognizedReceipt.getFields(); + FormField merchantNameField = recognizedFields.get("MerchantName"); + if (merchantNameField != null) { + if (FieldValueType.STRING.equals(merchantNameField.getValueType())) { + String merchantName = FieldValueType.STRING.cast(merchantNameField); + System.out.printf("Merchant Name: %s, confidence: %.2f%n", + merchantName, merchantNameField.getConfidence()); + } } - FormField transactionDateField = recognizedFields.get("TransactionDate"); - if (transactionDateField.getFieldValue().getType() == FieldValueType.DATE) { - System.out.printf("Transaction Date: %s, confidence: %.2f%n", - transactionDateField.getFieldValue().asDate(), - transactionDateField.getConfidence()); + + FormField merchantPhoneNumberField = recognizedFields.get("MerchantPhoneNumber"); + if (merchantPhoneNumberField != null) { + if (FieldValueType.PHONE_NUMBER.equals(merchantNameField.getValueType())) { + String merchantAddress = FieldValueType.PHONE_NUMBER.cast(merchantPhoneNumberField); + System.out.printf("Merchant Phone number: %s, confidence: %.2f%n", + merchantAddress, merchantPhoneNumberField.getConfidence()); + } + } + + FormField transactionDateField = recognizedFields.get("TransactionDate"); + if (transactionDateField != null) { + if (FieldValueType.DATE.equals(transactionDateField.getValueType())) { + LocalDate transactionDate = FieldValueType.DATE.cast(transactionDateField); + System.out.printf("Transaction Date: %s, confidence: %.2f%n", + transactionDate, transactionDateField.getConfidence()); + } } - FormField receiptItemsField = recognizedFields.get("Items"); - System.out.printf("Receipt Items: %n"); - if (receiptItemsField.getFieldValue().getType() == FieldValueType.LIST) { - List receiptItems = receiptItemsField.getFieldValue().asList(); - receiptItems.forEach(receiptItem -> { - if (receiptItem.getFieldValue().getType() == FieldValueType.MAP) { - receiptItem.getFieldValue().asMap().forEach((key, formField) -> { - if (key.equals("Quantity")) { - if (formField.getFieldValue().getType() == FieldValueType.INTEGER) { - System.out.printf("Quantity: %d, confidence: %.2f%n", - formField.getFieldValue().asInteger(), formField.getConfidence()); + + FormField receiptItemsField = recognizedFields.get("Items"); + if (receiptItemsField != null) { + System.out.printf("Receipt Items: %n"); + if (FieldValueType.LIST.equals(receiptItemsField.getValueType())) { + List> receiptItems = FieldValueType.LIST.cast(receiptItemsField); + receiptItems.forEach(receiptItem -> { + if (FieldValueType.MAP.equals(receiptItem.getValueType())) { + Map> formFieldMap = FieldValueType.MAP.cast(receiptItem); + formFieldMap.forEach((key, formField) -> { + if ("Quantity".equals(key)) { + if (FieldValueType.DOUBLE.equals(formField.getValueType())) { + Float quantity = FieldValueType.DOUBLE.cast(formField); + System.out.printf("Quantity: %d, confidence: %.2f%n", + quantity, formField.getConfidence()); + } } - } - }); - } - }); + }); + } + }); + } } }); // END: com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeReceipts#InputStream-long-recognizeOptions diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/GetBoundingBoxes.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/GetBoundingBoxes.java index ed281654cad8..f6f72e2d9c95 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/GetBoundingBoxes.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/GetBoundingBoxes.java @@ -50,7 +50,7 @@ public static void main(String[] args) { recognizedForm.getFields().forEach((fieldText, fieldValue) -> System.out.printf("Field %s has value %s " + "based on %s with a confidence score " + "of %.2f.%n", - fieldText, fieldValue.getFieldValue(), fieldValue.getValueData().getText(), + fieldText, fieldValue.getValue(), fieldValue.getValueData().getText(), fieldValue.getConfidence())); // Page Information diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/GetBoundingBoxesAsync.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/GetBoundingBoxesAsync.java index c8931c16ab2a..ebfad4bdc35f 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/GetBoundingBoxesAsync.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/GetBoundingBoxesAsync.java @@ -63,7 +63,7 @@ public static void main(String[] args) { recognizedForm.getFields().forEach((fieldText, fieldValue) -> { System.out.printf("Field %s has value %s based on %s with a confidence score " + "of %.2f.%n", - fieldText, fieldValue.getFieldValue(), fieldValue.getValueData().getText(), + fieldText, fieldValue.getValue(), fieldValue.getValueData().getText(), fieldValue.getConfidence()); }); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/ReadmeSamples.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/ReadmeSamples.java index d58e884434b3..e1851afe0cd4 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/ReadmeSamples.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/ReadmeSamples.java @@ -11,7 +11,6 @@ import com.azure.ai.formrecognizer.models.FormPage; import com.azure.ai.formrecognizer.models.OperationResult; import com.azure.ai.formrecognizer.models.RecognizedForm; -import com.azure.ai.formrecognizer.models.RecognizedReceipt; import com.azure.ai.formrecognizer.training.FormTrainingClient; import com.azure.ai.formrecognizer.training.FormTrainingClientBuilder; import com.azure.core.credential.AzureKeyCredential; @@ -26,6 +25,7 @@ import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; +import java.time.LocalDate; import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicReference; @@ -95,14 +95,13 @@ public void recognizeCustomForm() { for (int i = 0; i < recognizedForms.size(); i++) { RecognizedForm form = recognizedForms.get(i); - System.out.printf("----------- Recognized Form %d-----------%n", i); + System.out.printf("----------- Recognized Form %d -----------%n", i); System.out.printf("Form type: %s%n", form.getFormType()); - form.getFields().forEach((label, formField) -> { + form.getFields().forEach((label, formField) -> System.out.printf("Field %s has value %s with confidence score of %f.%n", label, formField.getValueData().getText(), - formField.getConfidence()); - }); - System.out.print("-----------------------------------"); + formField.getConfidence()) + ); } } @@ -124,7 +123,7 @@ public void recognizeContent() throws IOException { for (int i = 0; i < contentPageResults.size(); i++) { FormPage formPage = contentPageResults.get(i); - System.out.printf("----Recognizing content for page %d----%n", i); + System.out.printf("----Recognizing content for page %d ----%n", i); // Table information System.out.printf("Has width: %f and height: %f, measured with unit: %s.%n", formPage.getWidth(), formPage.getHeight(), @@ -132,10 +131,8 @@ public void recognizeContent() throws IOException { formPage.getTables().forEach(formTable -> { System.out.printf("Table has %d rows and %d columns.%n", formTable.getRowCount(), formTable.getColumnCount()); - formTable.getCells().forEach(formTableCell -> { - System.out.printf("Cell has text %s.%n", formTableCell.getText()); - }); - System.out.println(); + formTable.getCells().forEach(formTableCell -> + System.out.printf("Cell has text %s.%n", formTableCell.getText())); }); } } @@ -143,49 +140,61 @@ public void recognizeContent() throws IOException { public void recognizeReceipt() { String receiptUrl = "https://docs.microsoft.com/en-us/azure/cognitive-services/form-recognizer/media" + "/contoso-allinone.jpg"; - SyncPoller> syncPoller = + SyncPoller> syncPoller = formRecognizerClient.beginRecognizeReceiptsFromUrl(receiptUrl); - List receiptPageResults = syncPoller.getFinalResult(); + List receiptPageResults = syncPoller.getFinalResult(); for (int i = 0; i < receiptPageResults.size(); i++) { - RecognizedReceipt recognizedReceipt = receiptPageResults.get(i); - Map recognizedFields = recognizedReceipt.getRecognizedForm().getFields(); + RecognizedForm recognizedForm = receiptPageResults.get(i); + Map> recognizedFields = recognizedForm.getFields(); System.out.printf("----------- Recognized Receipt page %d -----------%n", i); - FormField merchantNameField = recognizedFields.get("MerchantName"); - if (merchantNameField.getFieldValue().getType() == FieldValueType.STRING) { - System.out.printf("Merchant Name: %s, confidence: %.2f%n", - merchantNameField.getFieldValue().asString(), - merchantNameField.getConfidence()); + FormField merchantNameField = recognizedFields.get("MerchantName"); + if (merchantNameField != null) { + if (FieldValueType.STRING.equals(merchantNameField.getValueType())) { + String merchantName = FieldValueType.STRING.cast(merchantNameField); + System.out.printf("Merchant Name: %s, confidence: %.2f%n", + merchantName, merchantNameField.getConfidence()); + } } - FormField transactionDateField = recognizedFields.get("TransactionDate"); - if (transactionDateField.getFieldValue().getType() == FieldValueType.DATE) { - System.out.printf("Transaction Date: %s, confidence: %.2f%n", - transactionDateField.getFieldValue().asDate(), - transactionDateField.getConfidence()); + + FormField merchantPhoneNumberField = recognizedFields.get("MerchantPhoneNumber"); + if (merchantPhoneNumberField != null) { + if (FieldValueType.PHONE_NUMBER.equals(merchantNameField.getValueType())) { + String merchantAddress = FieldValueType.PHONE_NUMBER.cast(merchantPhoneNumberField); + System.out.printf("Merchant Phone number: %s, confidence: %.2f%n", + merchantAddress, merchantPhoneNumberField.getConfidence()); + } } - FormField receiptItemsField = recognizedFields.get("Items"); - System.out.printf("Receipt Items: %n"); - if (receiptItemsField.getFieldValue().getType() == FieldValueType.LIST) { - List receiptItems = receiptItemsField.getFieldValue().asList(); - receiptItems.forEach(receiptItem -> { - if (receiptItem.getFieldValue().getType() == FieldValueType.MAP) { - receiptItem.getFieldValue().asMap().forEach((key, formField) -> { - if (key.equals("Name")) { - if (formField.getFieldValue().getType() == FieldValueType.STRING) { - System.out.printf("Name: %s, confidence: %.2fs%n", - formField.getFieldValue().asString(), - formField.getConfidence()); - } - } - if (key.equals("Quantity")) { - if (formField.getFieldValue().getType() == FieldValueType.INTEGER) { - System.out.printf("Quantity: %d, confidence: %.2f%n", - formField.getFieldValue().asInteger(), formField.getConfidence()); + + FormField transactionDateField = recognizedFields.get("TransactionDate"); + if (transactionDateField != null) { + if (FieldValueType.DATE.equals(transactionDateField.getValueType())) { + LocalDate transactionDate = FieldValueType.DATE.cast(transactionDateField); + System.out.printf("Transaction Date: %s, confidence: %.2f%n", + transactionDate, transactionDateField.getConfidence()); + } + } + + FormField receiptItemsField = recognizedFields.get("Items"); + if (receiptItemsField != null) { + System.out.printf("Receipt Items: %n"); + if (FieldValueType.LIST.equals(receiptItemsField.getValueType())) { + List> receiptItems = FieldValueType.LIST.cast(receiptItemsField); + receiptItems.forEach(receiptItem -> { + if (FieldValueType.MAP.equals(receiptItem.getValueType())) { + Map> formFieldMap = FieldValueType.MAP.cast(receiptItem); + formFieldMap.forEach((key, formField) -> { + if ("Quantity".equals(key)) { + if (FieldValueType.DOUBLE.equals(formField.getValueType())) { + Float quantity = FieldValueType.DOUBLE.cast(formField); + System.out.printf("Quantity: %f, confidence: %.2f%n", + quantity, formField.getConfidence()); + } } - } - }); - } - }); + }); + } + }); + } } } } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/Receipt.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/Receipt.java new file mode 100644 index 000000000000..f174d8f2ff62 --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/Receipt.java @@ -0,0 +1,360 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.formrecognizer; + +import com.azure.ai.formrecognizer.models.FormField; +import com.azure.ai.formrecognizer.models.RecognizedForm; +import com.azure.core.annotation.Immutable; + +import java.time.LocalDate; +import java.time.LocalTime; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +/** + * The Receipt model. + */ +public final class Receipt { + + /** + * List of recognized field items. + */ + private List receiptItems; + + /** + * Recognized receipt type information. + */ + private ReceiptType receiptType; + + /** + * Recognized field merchant name. + */ + private FormField merchantName; + + /** + * Recognized field merchant address. + */ + private FormField merchantAddress; + + /** + * Recognized field merchant phone number. + */ + private FormField merchantPhoneNumber; + + /** + * Recognized field subtotal. + */ + private FormField subtotal; + + /** + * Recognized field tax. + */ + private FormField tax; + + /** + * Recognized field tip. + */ + private FormField tip; + + /** + * Recognized field total. + */ + private FormField total; + + /** + * Recognized field transaction date. + */ + private FormField transactionDate; + + /** + * Recognized field transaction time. + */ + private FormField transactionTime; + + @SuppressWarnings("unchecked") + public Receipt(RecognizedForm recognizedForm) { + for (Map.Entry> entry : recognizedForm.getFields().entrySet()) { + String key = entry.getKey(); + FormField fieldValue = entry.getValue(); + switch (key) { + case "ReceiptType": + receiptType = new ReceiptType(((FormField) fieldValue).getValue(), + fieldValue.getConfidence()); + break; + case "MerchantName": + merchantName = (FormField) fieldValue; + break; + case "MerchantAddress": + merchantAddress = (FormField) fieldValue; + break; + case "MerchantPhoneNumber": + merchantPhoneNumber = (FormField) fieldValue; + break; + case "Subtotal": + subtotal = (FormField) fieldValue; + break; + case "Tax": + tax = (FormField) fieldValue; + break; + case "Tip": + tip = (FormField) fieldValue; + break; + case "Total": + total = (FormField) fieldValue; + break; + case "TransactionDate": + transactionDate = (FormField) fieldValue; + break; + case "TransactionTime": + transactionTime = (FormField) fieldValue; + break; + case "Items": + receiptItems = Collections.unmodifiableList(toReceiptItems(fieldValue)); + break; + default: + break; + } + } + } + + /** + * Get the itemized fields in the Recognized Receipt. + * + * @return the unmodifiable list of itemized fields on the receipt. + */ + public List getReceiptItems() { + return this.receiptItems; + } + + /** + * Get the type of Recognized Receipt. + * + * @return the type of Recognized Receipt. + */ + public ReceiptType getReceiptType() { + return this.receiptType; + } + + /** + * Get the merchant name field. + * + * @return the merchantName value. + */ + public FormField getMerchantName() { + return this.merchantName; + } + + /** + * Get the merchant address field. + * + * @return the merchantAddress value. + */ + public FormField getMerchantAddress() { + return this.merchantAddress; + } + + /** + * Get the merchant Phone number field. + * + * @return the merchantPhoneNumber value. + */ + public FormField getMerchantPhoneNumber() { + return this.merchantPhoneNumber; + } + + /** + * Get the subtotal field. + * + * @return the subtotal value. + */ + public FormField getSubtotal() { + return this.subtotal; + } + + /** + * Get the tax field. + * + * @return the tax value. + */ + public FormField getTax() { + return this.tax; + } + + /** + * Get the tip field. + * + * @return the tip value. + */ + public FormField getTip() { + return this.tip; + } + + /** + * Get the Total field. + * + * @return the total value. + */ + public FormField getTotal() { + return this.total; + } + + /** + * Get the Transaction date field. + * + * @return the transactionDate value. + */ + public FormField getTransactionDate() { + return this.transactionDate; + } + + /** + * Get the transaction time field. + * + * @return the transactionTime value. + */ + public FormField getTransactionTime() { + return this.transactionTime; + } + + /** + * Helper method to convert the service level + * {@link com.azure.ai.formrecognizer.implementation.models.FieldValue#getValueArray() value items} + * to SDK level {@link ReceiptItem receipt items}. + * + * @param fieldValueItems The strongly typed field values. + * b + * + * @return An unmodifiable list of {@link ReceiptItem}. + */ + @SuppressWarnings("unchecked") + private static List toReceiptItems(FormField fieldValueItems) { + List> fieldValueArray = (List>) fieldValueItems.getValue(); + List receiptItemList = new ArrayList<>(); + + for (FormField eachFieldValue : fieldValueArray) { + Map> objectValue = ((Map>) (eachFieldValue.getValue())); + FormField name = null; + FormField quantity = null; + FormField price = null; + FormField totalPrice = null; + for (Map.Entry> entry : objectValue.entrySet()) { + String key = entry.getKey(); + if ("Quantity".equals(key)) { + quantity = (FormField) entry.getValue(); + } else if ("Name".equals(key)) { + name = (FormField) entry.getValue(); + } else if ("Price".equals(key)) { + price = (FormField) entry.getValue(); + } else if ("Total Price".equals(key)) { + totalPrice = (FormField) entry.getValue(); + } + } + receiptItemList.add(new ReceiptItem(name, quantity, price, totalPrice)); + } + return Collections.unmodifiableList(receiptItemList); + } + + /** + * The USReceiptType model. + */ + @Immutable + public static final class ReceiptType { + private final String type; + private final float confidence; + + /** + * Constructs a Receipt Type. + * + * @param type The type of the receipt. + * @param confidence The confidence score. + */ + public ReceiptType(final String type, final float confidence) { + this.type = type; + this.confidence = confidence; + } + + /** + * Gets the type of the receipt. + * + * @return The type of the receipt. + */ + public String getType() { + return this.type; + } + + /** + * Gets the confidence score of the detected type of the receipt. + * + * @return The confidence score of the detected type of the receipt. + */ + public float getConfidence() { + return this.confidence; + } + } + + /** + * The ReceiptItem model. + */ + @Immutable + public static final class ReceiptItem { + private final FormField name; + private final FormField quantity; + private final FormField price; + private final FormField totalPrice; + + /** + * Constructs a ReceiptItem object. + * + * @param name Name of the field value. + * @param quantity quantity of the field value. + * @param price price of the field value. + * @param totalPrice Total price of the field value. + */ + public ReceiptItem(final FormField name, final FormField quantity, final FormField price, + final FormField totalPrice) { + this.name = name; + this.quantity = quantity; + this.price = price; + this.totalPrice = totalPrice; + } + + /** + * Gets the name of the field value. + * + * @return The name of the field value. + */ + public FormField getName() { + return name; + } + + /** + * Gets the quantity of the Receipt Item. + * + * @return the quantity of Receipt Item. + */ + public FormField getQuantity() { + return quantity; + } + + /** + * Gets the price of the Receipt Item. + * + * @return The total Price. + */ + public FormField getPrice() { + return price; + } + + /** + * Gets the total price of the Receipt Item. + * + * @return The total Price. + */ + public FormField getTotalPrice() { + return totalPrice; + } + } +} diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/RecognizeReceipts.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/RecognizeReceipts.java index da6871ca95b8..cd612e70d4a6 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/RecognizeReceipts.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/RecognizeReceipts.java @@ -6,7 +6,7 @@ import com.azure.ai.formrecognizer.models.FieldValueType; import com.azure.ai.formrecognizer.models.FormField; import com.azure.ai.formrecognizer.models.OperationResult; -import com.azure.ai.formrecognizer.models.RecognizedReceipt; +import com.azure.ai.formrecognizer.models.RecognizedForm; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.util.polling.SyncPoller; @@ -15,11 +15,15 @@ import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; +import java.time.LocalDate; import java.util.List; import java.util.Map; /** - * Sample for recognizing US receipt information using file source URL. + * Sample for recognizing commonly found US receipt fields from a local file input stream. + * For a suggested approach to extracting information from receipts, see StronglyTypedRecognizedForm.java. + * See fields found on a receipt here: + * https://aka.ms/azsdk/python/formrecognizer/receiptfields */ public class RecognizeReceipts { @@ -42,72 +46,86 @@ public static void main(final String[] args) throws IOException { byte[] fileContent = Files.readAllBytes(sourceFile.toPath()); InputStream targetStream = new ByteArrayInputStream(fileContent); - SyncPoller> analyzeReceiptPoller = + SyncPoller> analyzeReceiptPoller = client.beginRecognizeReceipts(targetStream, sourceFile.length()); - List receiptPageResults = analyzeReceiptPoller.getFinalResult(); + List receiptPageResults = analyzeReceiptPoller.getFinalResult(); for (int i = 0; i < receiptPageResults.size(); i++) { - RecognizedReceipt recognizedReceipt = receiptPageResults.get(i); - Map recognizedFields = recognizedReceipt.getRecognizedForm().getFields(); + RecognizedForm recognizedForm = receiptPageResults.get(i); + Map> recognizedFields = recognizedForm.getFields(); System.out.printf("----------- Recognized Receipt page %d -----------%n", i); - FormField merchantNameField = recognizedFields.get("MerchantName"); + FormField merchantNameField = recognizedFields.get("MerchantName"); if (merchantNameField != null) { - if (merchantNameField.getFieldValue().getType() == FieldValueType.STRING) { + if (FieldValueType.STRING.equals(merchantNameField.getValueType())) { + String merchantName = FieldValueType.STRING.cast(merchantNameField); System.out.printf("Merchant Name: %s, confidence: %.2f%n", - merchantNameField.getFieldValue().asString(), - merchantNameField.getConfidence()); + merchantName, merchantNameField.getConfidence()); } } - FormField merchantAddressField = recognizedFields.get("MerchantAddress"); + + FormField merchantPhoneNumberField = recognizedFields.get("MerchantPhoneNumber"); + if (merchantPhoneNumberField != null) { + if (FieldValueType.PHONE_NUMBER.equals(merchantNameField.getValueType())) { + String merchantAddress = FieldValueType.PHONE_NUMBER.cast(merchantPhoneNumberField); + System.out.printf("Merchant Phone number: %s, confidence: %.2f%n", + merchantAddress, merchantPhoneNumberField.getConfidence()); + } + } + + FormField merchantAddressField = recognizedFields.get("MerchantAddress"); if (merchantAddressField != null) { - if (merchantAddressField.getFieldValue().getType() == FieldValueType.STRING) { + if (FieldValueType.STRING.equals(merchantNameField.getValueType())) { + String merchantAddress = FieldValueType.STRING.cast(merchantAddressField); System.out.printf("Merchant Address: %s, confidence: %.2f%n", - merchantAddressField.getFieldValue().asString(), - merchantAddressField.getConfidence()); + merchantAddress, merchantAddressField.getConfidence()); } } - FormField transactionDateField = recognizedFields.get("TransactionDate"); + + FormField transactionDateField = recognizedFields.get("TransactionDate"); if (transactionDateField != null) { - if (transactionDateField.getFieldValue().getType() == FieldValueType.DATE) { + if (FieldValueType.DATE.equals(transactionDateField.getValueType())) { + LocalDate transactionDate = FieldValueType.DATE.cast(transactionDateField); System.out.printf("Transaction Date: %s, confidence: %.2f%n", - transactionDateField.getFieldValue().asDate(), - transactionDateField.getConfidence()); + transactionDate, transactionDateField.getConfidence()); } } - FormField receiptItemsField = recognizedFields.get("Items"); + + FormField receiptItemsField = recognizedFields.get("Items"); if (receiptItemsField != null) { System.out.printf("Receipt Items: %n"); - if (receiptItemsField.getFieldValue().getType() == FieldValueType.LIST) { - List receiptItems = receiptItemsField.getFieldValue().asList(); + if (FieldValueType.LIST.equals(receiptItemsField.getValueType())) { + List> receiptItems = FieldValueType.LIST.cast(receiptItemsField); receiptItems.forEach(receiptItem -> { - if (receiptItem.getFieldValue().getType() == FieldValueType.MAP) { - receiptItem.getFieldValue().asMap().forEach((key, formField) -> { - if (key.equals("Name")) { - if (formField.getFieldValue().getType() == FieldValueType.STRING) { + if (FieldValueType.MAP.equals(receiptItem.getValueType())) { + Map> formFieldMap = FieldValueType.MAP.cast(receiptItem); + formFieldMap.forEach((key, formField) -> { + if ("Name".equals(key)) { + if (FieldValueType.STRING.equals(formField.getValueType())) { + String name = FieldValueType.STRING.cast(formField); System.out.printf("Name: %s, confidence: %.2fs%n", - formField.getFieldValue().asString(), - formField.getConfidence()); + name, formField.getConfidence()); } } - if (key.equals("Quantity")) { - if (formField.getFieldValue().getType() == FieldValueType.INTEGER) { - System.out.printf("Quantity: %d, confidence: %.2f%n", - formField.getFieldValue().asInteger(), formField.getConfidence()); + if ("Quantity".equals(key)) { + if (FieldValueType.DOUBLE.equals(formField.getValueType())) { + Float quantity = FieldValueType.DOUBLE.cast(formField); + System.out.printf("Quantity: %f, confidence: %.2f%n", + quantity, formField.getConfidence()); } } - if (key.equals("Price")) { - if (formField.getFieldValue().getType() == FieldValueType.FLOAT) { + if ("Price".equals(key)) { + if (FieldValueType.DOUBLE.equals(formField.getValueType())) { + Float price = FieldValueType.DOUBLE.cast(formField); System.out.printf("Price: %f, confidence: %.2f%n", - formField.getFieldValue().asFloat(), - formField.getConfidence()); + price, formField.getConfidence()); } } - if (key.equals("TotalPrice")) { - if (formField.getFieldValue().getType() == FieldValueType.FLOAT) { + if ("TotalPrice".equals(key)) { + if (FieldValueType.DOUBLE.equals(formField.getValueType())) { + Float totalPrice = FieldValueType.DOUBLE.cast(formField); System.out.printf("Total Price: %f, confidence: %.2f%n", - formField.getFieldValue().asFloat(), - formField.getConfidence()); + totalPrice, formField.getConfidence()); } } }); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/RecognizeReceiptsAsync.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/RecognizeReceiptsAsync.java index f59aeb97cb60..d9c1b3849187 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/RecognizeReceiptsAsync.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/RecognizeReceiptsAsync.java @@ -6,7 +6,7 @@ import com.azure.ai.formrecognizer.models.FieldValueType; import com.azure.ai.formrecognizer.models.FormField; import com.azure.ai.formrecognizer.models.OperationResult; -import com.azure.ai.formrecognizer.models.RecognizedReceipt; +import com.azure.ai.formrecognizer.models.RecognizedForm; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.util.polling.PollerFlux; import reactor.core.publisher.Mono; @@ -16,6 +16,7 @@ import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; +import java.time.LocalDate; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; @@ -23,7 +24,10 @@ import static com.azure.ai.formrecognizer.implementation.Utility.toFluxByteBuffer; /** - * Async sample for recognizing US receipt information from a local file. + * Async sample for recognizing commonly found US receipt fields from a local file input stream. + * For a suggested approach to extracting information from receipts, see StronglyTypedRecognizedForm.java. + * See fields found on a receipt here: + * https://aka.ms/azsdk/python/formrecognizer/receiptfields */ public class RecognizeReceiptsAsync { @@ -31,6 +35,7 @@ public class RecognizeReceiptsAsync { * Main method to invoke this demo. * * @param args Unused. Arguments to the program. + * * @throws IOException Exception thrown when there is an error in reading all the bytes from the File. */ public static void main(final String[] args) throws IOException { @@ -45,11 +50,11 @@ public static void main(final String[] args) throws IOException { byte[] fileContent = Files.readAllBytes(sourceFile.toPath()); InputStream targetStream = new ByteArrayInputStream(fileContent); - PollerFlux> analyzeReceiptPoller = + PollerFlux> analyzeReceiptPoller = client.beginRecognizeReceipts(toFluxByteBuffer(targetStream), sourceFile.length()); - Mono> receiptPageResultsMono = analyzeReceiptPoller + Mono> receiptPageResultsMono = analyzeReceiptPoller .last() .flatMap(recognizeReceiptPollOperation -> { if (recognizeReceiptPollOperation.getStatus().isComplete()) { @@ -64,66 +69,80 @@ public static void main(final String[] args) throws IOException { receiptPageResultsMono.subscribe(receiptPageResults -> { for (int i = 0; i < receiptPageResults.size(); i++) { - RecognizedReceipt recognizedReceipt = receiptPageResults.get(i); - Map recognizedFields = recognizedReceipt.getRecognizedForm().getFields(); + RecognizedForm recognizedForm = receiptPageResults.get(i); + Map> recognizedFields = recognizedForm.getFields(); System.out.printf("----------- Recognized Receipt page %d -----------%n", i); - FormField merchantNameField = recognizedFields.get("MerchantName"); + FormField merchantNameField = recognizedFields.get("MerchantName"); if (merchantNameField != null) { - if (merchantNameField.getFieldValue().getType() == FieldValueType.STRING) { + if (FieldValueType.STRING.equals(merchantNameField.getValueType())) { + String merchantName = FieldValueType.STRING.cast(merchantNameField); System.out.printf("Merchant Name: %s, confidence: %.2f%n", - merchantNameField.getFieldValue().asString(), - merchantNameField.getConfidence()); + merchantName, merchantNameField.getConfidence()); + } + } + + FormField merchantPhoneNumberField = recognizedFields.get("MerchantPhoneNumber"); + if (merchantPhoneNumberField != null) { + if (FieldValueType.PHONE_NUMBER.equals(merchantNameField.getValueType())) { + String merchantAddress = FieldValueType.PHONE_NUMBER.cast(merchantPhoneNumberField); + System.out.printf("Merchant Phone number: %s, confidence: %.2f%n", + merchantAddress, merchantPhoneNumberField.getConfidence()); } } - FormField merchantAddressField = recognizedFields.get("MerchantAddress"); + + FormField merchantAddressField = recognizedFields.get("MerchantAddress"); if (merchantAddressField != null) { - if (merchantAddressField.getFieldValue().getType() == FieldValueType.STRING) { + if (FieldValueType.STRING.equals(merchantNameField.getValueType())) { + String merchantAddress = FieldValueType.STRING.cast(merchantAddressField); System.out.printf("Merchant Address: %s, confidence: %.2f%n", - merchantAddressField.getFieldValue().asString(), - merchantAddressField.getConfidence()); + merchantAddress, merchantAddressField.getConfidence()); } } - FormField transactionDateField = recognizedFields.get("TransactionDate"); + + FormField transactionDateField = recognizedFields.get("TransactionDate"); if (transactionDateField != null) { - if (transactionDateField.getFieldValue().getType() == FieldValueType.DATE) { + if (FieldValueType.DATE.equals(transactionDateField.getValueType())) { + LocalDate transactionDate = FieldValueType.DATE.cast(transactionDateField); System.out.printf("Transaction Date: %s, confidence: %.2f%n", - transactionDateField.getFieldValue().asDate(), - transactionDateField.getConfidence()); + transactionDate, transactionDateField.getConfidence()); } } - FormField receiptItemsField = recognizedFields.get("Items"); + + FormField receiptItemsField = recognizedFields.get("Items"); if (receiptItemsField != null) { System.out.printf("Receipt Items: %n"); - if (receiptItemsField.getFieldValue().getType() == FieldValueType.LIST) { - List receiptItems = receiptItemsField.getFieldValue().asList(); + if (FieldValueType.LIST.equals(receiptItemsField.getValueType())) { + List> receiptItems = FieldValueType.LIST.cast(receiptItemsField); receiptItems.forEach(receiptItem -> { - if (receiptItem.getFieldValue().getType() == FieldValueType.MAP) { - receiptItem.getFieldValue().asMap().forEach((key, formField) -> { - if (key.equals("Name")) { - if (formField.getFieldValue().getType() == FieldValueType.STRING) { + if (FieldValueType.MAP.equals(receiptItem.getValueType())) { + Map> formFieldMap = FieldValueType.MAP.cast(receiptItem); + formFieldMap.forEach((key, formField) -> { + if ("Name".equals(key)) { + if (FieldValueType.STRING.equals(formField.getValueType())) { + String name = FieldValueType.STRING.cast(formField); System.out.printf("Name: %s, confidence: %.2fs%n", - formField.getFieldValue().asString(), - formField.getConfidence()); + name, formField.getConfidence()); } } - if (key.equals("Quantity")) { - if (formField.getFieldValue().getType() == FieldValueType.INTEGER) { - System.out.printf("Quantity: %d, confidence: %.2f%n", - formField.getFieldValue().asInteger(), formField.getConfidence()); + if ("Quantity".equals(key)) { + if (FieldValueType.DOUBLE.equals(formField.getValueType())) { + Float quantity = FieldValueType.DOUBLE.cast(formField); + System.out.printf("Quantity: %f, confidence: %.2f%n", + quantity, formField.getConfidence()); } } - if (key.equals("Price")) { - if (formField.getFieldValue().getType() == FieldValueType.FLOAT) { + if ("Price".equals(key)) { + if (FieldValueType.DOUBLE.equals(formField.getValueType())) { + Float price = FieldValueType.DOUBLE.cast(formField); System.out.printf("Price: %f, confidence: %.2f%n", - formField.getFieldValue().asFloat(), - formField.getConfidence()); + price, formField.getConfidence()); } } - if (key.equals("TotalPrice")) { - if (formField.getFieldValue().getType() == FieldValueType.FLOAT) { + if ("TotalPrice".equals(key)) { + if (FieldValueType.DOUBLE.equals(formField.getValueType())) { + Float totalPrice = FieldValueType.DOUBLE.cast(formField); System.out.printf("Total Price: %f, confidence: %.2f%n", - formField.getFieldValue().asFloat(), - formField.getConfidence()); + totalPrice, formField.getConfidence()); } } }); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/RecognizeReceiptsFromUrl.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/RecognizeReceiptsFromUrl.java index 8e7239f00dc0..df9c21ca7d09 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/RecognizeReceiptsFromUrl.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/RecognizeReceiptsFromUrl.java @@ -6,15 +6,19 @@ import com.azure.ai.formrecognizer.models.FieldValueType; import com.azure.ai.formrecognizer.models.FormField; import com.azure.ai.formrecognizer.models.OperationResult; -import com.azure.ai.formrecognizer.models.RecognizedReceipt; +import com.azure.ai.formrecognizer.models.RecognizedForm; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.util.polling.SyncPoller; +import java.time.LocalDate; import java.util.List; import java.util.Map; /** - * Sample for recognizing US receipt information using file source URL. + * Sample for recognizing commonly found US receipt fields from a file source URL. For a suggested approach to + * extracting information from receipts, see StronglyTypedRecognizedForm.java. + * See fields found on a receipt here: + * https://aka.ms/azsdk/python/formrecognizer/receiptfields */ public class RecognizeReceiptsFromUrl { @@ -30,73 +34,88 @@ public static void main(final String[] args) { .endpoint("https://{endpoint}.cognitiveservices.azure.com/") .buildClient(); - String receiptUrl = "https://raw.githubusercontent.com/Azure/azure-sdk-for-java/master/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/sample-forms/receipts/contoso-allinone.jpg"; - SyncPoller> recognizeReceiptPoller = + String receiptUrl = "https://raw.githubusercontent.com/Azure/azure-sdk-for-java/master/sdk/formrecognizer" + + "/azure-ai-formrecognizer/src/samples/java/sample-forms/receipts/contoso-allinone.jpg"; + SyncPoller> recognizeReceiptPoller = client.beginRecognizeReceiptsFromUrl(receiptUrl); - List receiptPageResults = recognizeReceiptPoller.getFinalResult(); + List receiptPageResults = recognizeReceiptPoller.getFinalResult(); for (int i = 0; i < receiptPageResults.size(); i++) { - RecognizedReceipt recognizedReceipt = receiptPageResults.get(i); - Map recognizedFields = recognizedReceipt.getRecognizedForm().getFields(); + RecognizedForm recognizedForm = receiptPageResults.get(i); + Map> recognizedFields = recognizedForm.getFields(); System.out.printf("----------- Recognized Receipt page %d -----------%n", i); - FormField merchantNameField = recognizedFields.get("MerchantName"); + FormField merchantNameField = recognizedFields.get("MerchantName"); if (merchantNameField != null) { - if (merchantNameField.getFieldValue().getType() == FieldValueType.STRING) { + if (FieldValueType.STRING.equals(merchantNameField.getValueType())) { + String merchantName = FieldValueType.STRING.cast(merchantNameField); System.out.printf("Merchant Name: %s, confidence: %.2f%n", - merchantNameField.getFieldValue().asString(), - merchantNameField.getConfidence()); + merchantName, merchantNameField.getConfidence()); } } - FormField merchantAddressField = recognizedFields.get("MerchantAddress"); + + FormField merchantAddressField = recognizedFields.get("MerchantAddress"); if (merchantAddressField != null) { - if (merchantAddressField.getFieldValue().getType() == FieldValueType.STRING) { + if (FieldValueType.STRING.equals(merchantNameField.getValueType())) { + String merchantAddress = FieldValueType.STRING.cast(merchantAddressField); System.out.printf("Merchant Address: %s, confidence: %.2f%n", - merchantAddressField.getFieldValue().asString(), - merchantAddressField.getConfidence()); + merchantAddress, merchantAddressField.getConfidence()); + } + } + + FormField merchantPhoneNumberField = recognizedFields.get("MerchantPhoneNumber"); + if (merchantPhoneNumberField != null) { + if (FieldValueType.PHONE_NUMBER.equals(merchantNameField.getValueType())) { + String merchantAddress = FieldValueType.PHONE_NUMBER.cast(merchantPhoneNumberField); + System.out.printf("Merchant Phone number: %s, confidence: %.2f%n", + merchantAddress, merchantPhoneNumberField.getConfidence()); } } - FormField transactionDateField = recognizedFields.get("TransactionDate"); + + FormField transactionDateField = recognizedFields.get("TransactionDate"); if (transactionDateField != null) { - if (transactionDateField.getFieldValue().getType() == FieldValueType.DATE) { + if (FieldValueType.DATE.equals(transactionDateField.getValueType())) { + LocalDate transactionDate = FieldValueType.DATE.cast(transactionDateField); System.out.printf("Transaction Date: %s, confidence: %.2f%n", - transactionDateField.getFieldValue().asDate(), - transactionDateField.getConfidence()); + transactionDate, transactionDateField.getConfidence()); } } - FormField receiptItemsField = recognizedFields.get("Items"); + + FormField receiptItemsField = recognizedFields.get("Items"); if (receiptItemsField != null) { System.out.printf("Receipt Items: %n"); - if (receiptItemsField.getFieldValue().getType() == FieldValueType.LIST) { - List receiptItems = receiptItemsField.getFieldValue().asList(); + if (FieldValueType.LIST.equals(receiptItemsField.getValueType())) { + List> receiptItems = FieldValueType.LIST.cast(receiptItemsField); receiptItems.forEach(receiptItem -> { - if (receiptItem.getFieldValue().getType() == FieldValueType.MAP) { - receiptItem.getFieldValue().asMap().forEach((key, formField) -> { - if (key.equals("Name")) { - if (formField.getFieldValue().getType() == FieldValueType.STRING) { + if (FieldValueType.MAP.equals(receiptItem.getValueType())) { + Map> formFieldMap = FieldValueType.MAP.cast(receiptItem); + formFieldMap.forEach((key, formField) -> { + if ("Name".equals(key)) { + if (FieldValueType.STRING.equals(formField.getValueType())) { + String name = FieldValueType.STRING.cast(formField); System.out.printf("Name: %s, confidence: %.2fs%n", - formField.getFieldValue().asString(), - formField.getConfidence()); + name, formField.getConfidence()); } } - if (key.equals("Quantity")) { - if (formField.getFieldValue().getType() == FieldValueType.INTEGER) { - System.out.printf("Quantity: %d, confidence: %.2f%n", - formField.getFieldValue().asInteger(), formField.getConfidence()); + if ("Quantity".equals(key)) { + if (FieldValueType.DOUBLE.equals(formField.getValueType())) { + Float quantity = FieldValueType.DOUBLE.cast(formField); + System.out.printf("Quantity: %f, confidence: %.2f%n", + quantity, formField.getConfidence()); } } - if (key.equals("Price")) { - if (formField.getFieldValue().getType() == FieldValueType.FLOAT) { + if ("Price".equals(key)) { + if (FieldValueType.DOUBLE.equals(formField.getValueType())) { + Float price = FieldValueType.DOUBLE.cast(formField); System.out.printf("Price: %f, confidence: %.2f%n", - formField.getFieldValue().asFloat(), - formField.getConfidence()); + price, formField.getConfidence()); } } - if (key.equals("TotalPrice")) { - if (formField.getFieldValue().getType() == FieldValueType.FLOAT) { + if ("TotalPrice".equals(key)) { + if (FieldValueType.DOUBLE.equals(formField.getValueType())) { + Float totalPrice = FieldValueType.DOUBLE.cast(formField); System.out.printf("Total Price: %f, confidence: %.2f%n", - formField.getFieldValue().asFloat(), - formField.getConfidence()); + totalPrice, formField.getConfidence()); } } }); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/RecognizeReceiptsFromUrlAsync.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/RecognizeReceiptsFromUrlAsync.java index e6148c58664a..4df763056b81 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/RecognizeReceiptsFromUrlAsync.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/RecognizeReceiptsFromUrlAsync.java @@ -6,17 +6,21 @@ import com.azure.ai.formrecognizer.models.FieldValueType; import com.azure.ai.formrecognizer.models.FormField; import com.azure.ai.formrecognizer.models.OperationResult; -import com.azure.ai.formrecognizer.models.RecognizedReceipt; +import com.azure.ai.formrecognizer.models.RecognizedForm; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.util.polling.PollerFlux; import reactor.core.publisher.Mono; +import java.time.LocalDate; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; /** - * Async sample for recognizing US receipt information using file source URL. + * Async sample for recognizing commonly found US receipt fields from a file source URL. For a suggested approach to + * extracting information from receipts, see StronglyTypedRecognizedForm.java. + * See fields found on a receipt here: + * https://aka.ms/azsdk/python/formrecognizer/receiptfields */ public class RecognizeReceiptsFromUrlAsync { @@ -32,11 +36,12 @@ public static void main(final String[] args) { .endpoint("https://{endpoint}.cognitiveservices.azure.com/") .buildAsyncClient(); - String receiptUrl = "https://raw.githubusercontent.com/Azure/azure-sdk-for-java/master/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/sample-forms/receipts/contoso-allinone.jpg"; - PollerFlux> recognizeReceiptPoller = + String receiptUrl = "https://raw.githubusercontent.com/Azure/azure-sdk-for-java/master/sdk/formrecognizer" + + "/azure-ai-formrecognizer/src/samples/java/sample-forms/receipts/contoso-allinone.jpg"; + PollerFlux> recognizeReceiptPoller = client.beginRecognizeReceiptsFromUrl(receiptUrl); - Mono> receiptPageResults = recognizeReceiptPoller + Mono> receiptPageResults = recognizeReceiptPoller .last() .flatMap(trainingOperationResponse -> { if (trainingOperationResponse.getStatus().isComplete()) { @@ -51,66 +56,81 @@ public static void main(final String[] args) { receiptPageResults.subscribe(recognizedReceipts -> { for (int i = 0; i < recognizedReceipts.size(); i++) { - RecognizedReceipt recognizedReceipt = recognizedReceipts.get(i); - Map recognizedFields = recognizedReceipt.getRecognizedForm().getFields(); + RecognizedForm recognizedForm = recognizedReceipts.get(i); + Map> recognizedFields = recognizedForm.getFields(); System.out.printf("----------- Recognized Receipt page %d -----------%n", i); - FormField merchantNameField = recognizedFields.get("MerchantName"); + FormField merchantNameField = recognizedFields.get("MerchantName"); if (merchantNameField != null) { - if (merchantNameField.getFieldValue().getType() == FieldValueType.STRING) { + if (FieldValueType.STRING.equals(merchantNameField.getValueType())) { + String merchantName = FieldValueType.STRING.cast(merchantNameField); System.out.printf("Merchant Name: %s, confidence: %.2f%n", - merchantNameField.getFieldValue().asString(), - merchantNameField.getConfidence()); + merchantName, merchantNameField.getConfidence()); } } - FormField merchantAddressField = recognizedFields.get("MerchantAddress"); + + FormField merchantPhoneNumberField = recognizedFields.get("MerchantPhoneNumber"); + if (merchantPhoneNumberField != null) { + if (FieldValueType.PHONE_NUMBER.equals(merchantNameField.getValueType())) { + String merchantAddress = FieldValueType.PHONE_NUMBER.cast(merchantPhoneNumberField); + System.out.printf("Merchant Address: %s, confidence: %.2f%n", + merchantAddress, merchantPhoneNumberField.getConfidence()); + } + } + + FormField merchantAddressField = recognizedFields.get("MerchantAddress"); if (merchantAddressField != null) { - if (merchantAddressField.getFieldValue().getType() == FieldValueType.STRING) { + if (FieldValueType.STRING.equals(merchantNameField.getValueType())) { + String merchantAddress = FieldValueType.STRING.cast(merchantAddressField); System.out.printf("Merchant Address: %s, confidence: %.2f%n", - merchantAddressField.getFieldValue().asString(), - merchantAddressField.getConfidence()); + merchantAddress, merchantAddressField.getConfidence()); } } - FormField transactionDateField = recognizedFields.get("TransactionDate"); + + FormField transactionDateField = recognizedFields.get("TransactionDate"); if (transactionDateField != null) { - if (transactionDateField.getFieldValue().getType() == FieldValueType.DATE) { + if (FieldValueType.DATE.equals(transactionDateField.getValueType())) { + LocalDate transactionDate = FieldValueType.DATE.cast(transactionDateField); System.out.printf("Transaction Date: %s, confidence: %.2f%n", - transactionDateField.getFieldValue().asDate(), - transactionDateField.getConfidence()); + transactionDate, transactionDateField.getConfidence()); } } - FormField receiptItemsField = recognizedFields.get("Items"); + + FormField receiptItemsField = recognizedFields.get("Items"); if (receiptItemsField != null) { System.out.printf("Receipt Items: %n"); - if (receiptItemsField.getFieldValue().getType() == FieldValueType.LIST) { - List receiptItems = receiptItemsField.getFieldValue().asList(); + if (FieldValueType.LIST.equals(receiptItemsField.getValueType())) { + List> receiptItems = FieldValueType.LIST.cast(receiptItemsField); receiptItems.forEach(receiptItem -> { - if (receiptItem.getFieldValue().getType() == FieldValueType.MAP) { - receiptItem.getFieldValue().asMap().forEach((key, formField) -> { - if (key.equals("Name")) { - if (formField.getFieldValue().getType() == FieldValueType.STRING) { + if (FieldValueType.MAP.equals(receiptItem.getValueType())) { + // we still have to cast or assign + Map> formFieldMap = FieldValueType.MAP.cast(receiptItem); + formFieldMap.forEach((key, formField) -> { + if ("Name".equals(key)) { + if (FieldValueType.STRING.equals(formField.getValueType())) { + String name = FieldValueType.STRING.cast(formField); System.out.printf("Name: %s, confidence: %.2fs%n", - formField.getFieldValue().asString(), - formField.getConfidence()); + name, formField.getConfidence()); } } - if (key.equals("Quantity")) { - if (formField.getFieldValue().getType() == FieldValueType.INTEGER) { + if ("Quantity".equals(key)) { + if (FieldValueType.DOUBLE.equals(formField.getValueType())) { + Float quantity = FieldValueType.DOUBLE.cast(formField); System.out.printf("Quantity: %f, confidence: %.2f%n", - formField.getFieldValue().asInteger(), formField.getConfidence()); + quantity, formField.getConfidence()); } } - if (key.equals("Price")) { - if (formField.getFieldValue().getType() == FieldValueType.FLOAT) { + if ("Price".equals(key)) { + if (FieldValueType.DOUBLE.equals(formField.getValueType())) { + Float price = FieldValueType.DOUBLE.cast(formField); System.out.printf("Price: %f, confidence: %.2f%n", - formField.getFieldValue().asFloat(), - formField.getConfidence()); + price, formField.getConfidence()); } } - if (key.equals("TotalPrice")) { - if (formField.getFieldValue().getType() == FieldValueType.FLOAT) { + if ("TotalPrice".equals(key)) { + if (FieldValueType.DOUBLE.equals(formField.getValueType())) { + Float totalPrice = FieldValueType.DOUBLE.cast(formField); System.out.printf("Total Price: %f, confidence: %.2f%n", - formField.getFieldValue().asFloat(), - formField.getConfidence()); + totalPrice, formField.getConfidence()); } } }); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/StronglyTypedRecognizedForm.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/StronglyTypedRecognizedForm.java new file mode 100644 index 000000000000..f0144fdc9a56 --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/StronglyTypedRecognizedForm.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.formrecognizer; + +import com.azure.ai.formrecognizer.models.OperationResult; +import com.azure.ai.formrecognizer.models.RecognizedForm; +import com.azure.core.credential.AzureKeyCredential; +import com.azure.core.util.polling.SyncPoller; + +import java.util.List; + +/** + * Sample demonstrating converting recognized form fields to strongly typed US receipt field values. + * See + * + * for information on the strongly typed fields returned by service when recognizing receipts. + */ +public class StronglyTypedRecognizedForm { + + /** + * Main method to invoke this demo. + * + * @param args Unused. Arguments to the program. + */ + public static void main(final String[] args) { + // Instantiate a client that will be used to call the service. + FormRecognizerClient client = new FormRecognizerClientBuilder() + .credential(new AzureKeyCredential("{api_Key}")) + .endpoint("https://{endpoint}.cognitiveservices.azure.com/") + .buildClient(); + + String receiptUrl = "https://raw.githubusercontent.com/Azure/azure-sdk-for-java/master/sdk/formrecognizer" + + "/azure-ai-formrecognizer/src/samples/java/sample-forms/receipts/contoso-allinone.jpg"; + SyncPoller> recognizeReceiptPoller = + client.beginRecognizeReceiptsFromUrl(receiptUrl); + + List receiptPageResults = recognizeReceiptPoller.getFinalResult(); + + for (int i = 0; i < receiptPageResults.size(); i++) { + final RecognizedForm recognizedForm = receiptPageResults.get(i); + System.out.printf("----------- Recognized Receipt page %d -----------%n", i); + // Use Receipt model transform the recognized form to strongly typed US receipt fields + Receipt usReceipt = new Receipt(recognizedForm); + System.out.printf("Merchant Name: %s, confidence: %.2f%n", usReceipt.getMerchantName().getValue(), + usReceipt.getMerchantName().getConfidence()); + System.out.printf("Merchant Address: %s, confidence: %.2f%n", + usReceipt.getMerchantAddress().getValue(), + usReceipt.getMerchantAddress().getConfidence()); + System.out.printf("Merchant Phone Number %s, confidence: %.2f%n", + usReceipt.getMerchantPhoneNumber().getValue(), usReceipt.getMerchantPhoneNumber().getConfidence()); + System.out.printf("Total: %s confidence: %.2f%n", usReceipt.getTotal().getValue(), + usReceipt.getTotal().getConfidence()); + System.out.printf("Transaction Date: %s, confidence: %.2f%n", + usReceipt.getTransactionDate().getValue(), usReceipt.getTransactionDate().getConfidence()); + System.out.printf("Transaction Time: %s, confidence: %.2f%n", + usReceipt.getTransactionTime().getValue(), usReceipt.getTransactionTime().getConfidence()); + System.out.printf("Receipt Items: %n"); + usReceipt.getReceiptItems().forEach(receiptItem -> { + if (receiptItem.getName() != null) { + System.out.printf("Name: %s, confidence: %.2f%n", receiptItem.getName().getValue(), + receiptItem.getName().getConfidence()); + } + if (receiptItem.getQuantity() != null) { + System.out.printf("Quantity: %f, confidence: %.2f%n", receiptItem.getQuantity().getValue(), + receiptItem.getQuantity().getConfidence()); + } + if (receiptItem.getPrice() != null) { + System.out.printf("Price: %f, confidence: %.2f%n", receiptItem.getPrice().getValue(), + receiptItem.getPrice().getConfidence()); + } + if (receiptItem.getTotalPrice() != null) { + System.out.printf("Total Price: %f, confidence: %.2f%n", + receiptItem.getTotalPrice().getValue(), receiptItem.getTotalPrice().getConfidence()); + } + }); + System.out.print("-----------------------------------"); + } + } +} diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FieldValueTypeCastTest.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FieldValueTypeCastTest.java new file mode 100644 index 000000000000..1c74acbfcb93 --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FieldValueTypeCastTest.java @@ -0,0 +1,429 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.formrecognizer; + +import com.azure.ai.formrecognizer.models.FieldValueType; +import com.azure.ai.formrecognizer.models.FormField; +import org.junit.jupiter.api.Test; + +import java.time.LocalDate; +import java.time.LocalTime; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; + +public class FieldValueTypeCastTest { + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to Date. + */ + @Test + public void toDateFromDate() { + LocalDate inputDate = LocalDate.of(2006, 6, 6); + LocalDate actualDate = FieldValueType.DATE.cast(new FormField<>(0, null, null, + inputDate, null, FieldValueType.DATE)); + assertEquals(inputDate, actualDate); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to Date from String. + */ + @Test + public void toDateFromString() { + String inputDateString = "2006/06/06"; + LocalDate inputDate = LocalDate.parse(inputDateString, DateTimeFormatter.ofPattern("yyyy/MM/dd")); + LocalDate actualDate = FieldValueType.DATE.cast(new FormField<>(0, null, null, + inputDateString, null, FieldValueType.STRING)); + assertEquals(inputDate, actualDate); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to Date from null field value. + */ + @Test + public void toDateFromNull() { + assertNull(FieldValueType.DATE.cast(new FormField<>(0, null, null, + null, null, FieldValueType.STRING))); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to Date from any other + * FieldValueType except for String. + */ + @Test + public void toDateFromPhoneNumber() { + final UnsupportedOperationException unsupportedOperationException = + assertThrows(UnsupportedOperationException.class, () -> + FieldValueType.DATE.cast(new FormField<>(0, null, null, + "19876543210", null, FieldValueType.PHONE_NUMBER))); + assertEquals(unsupportedOperationException.getMessage(), "Cannot cast from field value of " + + "type PHONE_NUMBER to type DATE"); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to TIME. + */ + @Test + public void toTimeFromTime() { + LocalTime inputTime = LocalTime.parse("13:59:00", DateTimeFormatter.ofPattern("HH:mm:ss")); + LocalTime actualTime = FieldValueType.TIME.cast(new FormField<>(0, null, null, + inputTime, null, FieldValueType.TIME)); + assertEquals(inputTime, actualTime); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to TIME from String. + */ + @Test + public void toTimeFromString() { + String inputTimeString = "13:59:00"; + LocalTime inputTime = LocalTime.parse(inputTimeString, DateTimeFormatter.ofPattern("HH:mm:ss")); + LocalTime actualTime = FieldValueType.TIME.cast(new FormField<>(0, null, null, + inputTimeString, null, FieldValueType.STRING)); + assertEquals(inputTime, actualTime); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to TIME from null field value. + */ + @Test + public void toTimeFromNull() { + assertNull(FieldValueType.TIME.cast(new FormField<>(0, null, null, + null, null, FieldValueType.TIME))); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to TIME from any other + * FieldValueType except for String. + */ + @Test + public void toTimeFromPhoneNumber() { + final UnsupportedOperationException unsupportedOperationException = + assertThrows(UnsupportedOperationException.class, () -> + FieldValueType.TIME.cast(new FormField<>(0, null, null, + "19876543210", null, FieldValueType.PHONE_NUMBER))); + assertEquals(unsupportedOperationException.getMessage(), "Cannot cast from field value of " + + "type PHONE_NUMBER to type TIME"); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to list. + */ + @Test + public void toListFromList() { + List inputList = new ArrayList<>(Arrays.asList("1")); + List actualList = FieldValueType.LIST.cast(new FormField<>(0, null, null, + inputList, null, FieldValueType.LIST)); + assertEquals(inputList, actualList); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to list from String. + */ + @Test + public void toListFromString() { + String listString = "1"; + final UnsupportedOperationException unsupportedOperationException = + assertThrows(UnsupportedOperationException.class, () -> + FieldValueType.LIST.cast(new FormField<>(0, null, null, + listString, null, FieldValueType.STRING))); + assertEquals(unsupportedOperationException.getMessage(), "Cannot cast from field value of " + + "type STRING to type LIST"); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to list from null field value. + */ + @Test + public void toListFromNull() { + assertNull(FieldValueType.LIST.cast(new FormField<>(0, null, null, + null, null, FieldValueType.LIST))); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to list from any other + * FieldValueType except for String. + */ + @Test + public void toListFromTime() { + LocalTime inputTime = LocalTime.parse("13:59:00", DateTimeFormatter.ofPattern("HH:mm:ss")); + final UnsupportedOperationException unsupportedOperationException = + assertThrows(UnsupportedOperationException.class, () -> + FieldValueType.LIST.cast(new FormField<>(0, null, null, + inputTime, null, FieldValueType.TIME))); + assertEquals(unsupportedOperationException.getMessage(), "Cannot cast from field value of " + + "type TIME to type LIST"); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to phone number. + */ + @Test + public void toPhoneNumberFromPhoneNumber() { + String phoneNumber = "19876543210"; + String actualPhoneNumber = FieldValueType.PHONE_NUMBER.cast(new FormField<>(0, null, null, + phoneNumber, null, FieldValueType.PHONE_NUMBER)); + assertEquals(phoneNumber, actualPhoneNumber); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to phone number from String. + */ + @Test + public void toPhoneNumberFromString() { + String phoneNumber = "19876543210"; + String actualPhoneNumber = FieldValueType.PHONE_NUMBER.cast(new FormField<>(0, null, null, + phoneNumber, null, FieldValueType.STRING)); + assertEquals(phoneNumber, actualPhoneNumber); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to phone number from null field value. + */ + @Test + public void toPhoneNumberFromNull() { + assertNull(FieldValueType.PHONE_NUMBER.cast(new FormField<>(0, null, null, + null, null, FieldValueType.PHONE_NUMBER))); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to phone number from any other + * FieldValueType except for String. + */ + @Test + public void toPhoneNumberFromTime() { + LocalTime inputTime = LocalTime.parse("13:59:00", DateTimeFormatter.ofPattern("HH:mm:ss")); + final UnsupportedOperationException unsupportedOperationException = + assertThrows(UnsupportedOperationException.class, () -> + FieldValueType.PHONE_NUMBER.cast(new FormField<>(0, null, null, + inputTime, null, FieldValueType.TIME))); + assertEquals(unsupportedOperationException.getMessage(), "Cannot cast from field value of " + + "type TIME to type PHONE_NUMBER"); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to map. + */ + @Test + public void toMapFromMap() { + Map inputMap = Collections.singletonMap("key", "value"); + Map actualList = FieldValueType.MAP.cast(new FormField<>(0, null, null, + inputMap, null, FieldValueType.MAP)); + assertEquals(inputMap, actualList); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to map from String. + */ + @Test + public void toMapFromString() { + String listString = "1"; + final UnsupportedOperationException unsupportedOperationException = + assertThrows(UnsupportedOperationException.class, () -> + FieldValueType.MAP.cast(new FormField<>(0, null, null, + listString, null, FieldValueType.STRING))); + assertEquals(unsupportedOperationException.getMessage(), "Cannot cast from field value of " + + "type STRING to type MAP"); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to map from null field value. + */ + @Test + public void toMapFromNull() { + assertNull(FieldValueType.MAP.cast(new FormField<>(0, null, null, + null, null, FieldValueType.MAP))); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to map from any other + * FieldValueType except for String. + */ + @Test + public void toMapFromTime() { + LocalTime inputTime = LocalTime.parse("13:59:00", DateTimeFormatter.ofPattern("HH:mm:ss")); + final UnsupportedOperationException unsupportedOperationException = + assertThrows(UnsupportedOperationException.class, () -> + FieldValueType.MAP.cast(new FormField<>(0, null, null, + inputTime, null, FieldValueType.TIME))); + assertEquals(unsupportedOperationException.getMessage(), "Cannot cast from field value of " + + "type TIME to type MAP"); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to double. + */ + @Test + public void toDoubleFromDouble() { + Double inputDouble = 2.2; + Double actualDoubleValue = FieldValueType.DOUBLE.cast(new FormField<>(0, null, null, + inputDouble, null, FieldValueType.DOUBLE)); + assertEquals(inputDouble, actualDoubleValue); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to double from String. + */ + @Test + public void toDoubleFromString() { + String doubleString = "2.2"; + Double actualDouble = FieldValueType.DOUBLE.cast(new FormField<>(0, null, null, + doubleString, null, FieldValueType.STRING)); + assertEquals(Double.valueOf(doubleString), actualDouble); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to double from null field value. + */ + @Test + public void toDoubleFromNull() { + assertNull(FieldValueType.DOUBLE.cast(new FormField<>(0, null, null, + null, null, FieldValueType.DOUBLE))); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to double from any other + * FieldValueType except for String. + */ + @Test + public void toDoubleFromTime() { + LocalTime inputTime = LocalTime.parse("13:59:00", DateTimeFormatter.ofPattern("HH:mm:ss")); + final UnsupportedOperationException unsupportedOperationException = + assertThrows(UnsupportedOperationException.class, () -> + FieldValueType.DOUBLE.cast(new FormField<>(0, null, null, + inputTime, null, FieldValueType.TIME))); + assertEquals(unsupportedOperationException.getMessage(), "Cannot cast from field value of " + + "type TIME to type DOUBLE"); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to long. + */ + @Test + public void toLongFromLong() { + long inputDouble = 22; + Long actualLongValue = FieldValueType.LONG.cast(new FormField<>(0, null, null, + inputDouble, null, FieldValueType.LONG)); + assertEquals(inputDouble, actualLongValue); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to long from String. + */ + @Test + public void toLongFromString() { + String inputDoubleString = "22"; + Long actualLongValue = FieldValueType.LONG.cast(new FormField<>(0, null, null, + inputDoubleString, null, FieldValueType.STRING)); + assertEquals(Long.valueOf(inputDoubleString), actualLongValue); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to long from null field value. + */ + @Test + public void toLongFromNull() { + assertNull(FieldValueType.LONG.cast(new FormField<>(0, null, null, + null, null, FieldValueType.LONG))); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to long from any other + * FieldValueType except for String. + */ + @Test + public void toLongFromTime() { + LocalTime inputTime = LocalTime.parse("13:59:00", DateTimeFormatter.ofPattern("HH:mm:ss")); + final UnsupportedOperationException unsupportedOperationException = + assertThrows(UnsupportedOperationException.class, () -> + FieldValueType.LONG.cast(new FormField<>(0, null, null, + inputTime, null, FieldValueType.TIME))); + assertEquals(unsupportedOperationException.getMessage(), "Cannot cast from field value of " + + "type TIME to type LONG"); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to String from TIME. + */ + @Test + public void toStringFromTime() { + LocalTime inputTime = LocalTime.parse("13:59:00", DateTimeFormatter.ofPattern("HH:mm:ss")); + String localTimeString = FieldValueType.STRING.cast(new FormField<>(0, null, null, + inputTime, null, FieldValueType.TIME)); + assertEquals(inputTime.toString(), localTimeString); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to String from String. + */ + @Test + public void toStringFromString() { + String stringValue = "String value"; + String actualStringValue = FieldValueType.STRING.cast(new FormField<>(0, null, null, + stringValue, null, FieldValueType.STRING)); + assertEquals(stringValue, actualStringValue); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to String from double. + */ + @Test + public void toStringFromDouble() { + Double doubleValue = 2.2; + String actualDouble = FieldValueType.STRING.cast(new FormField<>(0, null, null, + doubleValue, null, FieldValueType.DOUBLE)); + assertEquals(String.valueOf(doubleValue), actualDouble); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to long from String. + */ + @Test + public void toStringFromLong() { + Long inputLong = 22L; + String actualLongValue = FieldValueType.STRING.cast(new FormField<>(0, null, null, + inputLong, null, FieldValueType.LONG)); + assertEquals(String.valueOf(inputLong), actualLongValue); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to String from Map. + */ + @Test + public void toStringFromMap() { + Map inputMap = Collections.singletonMap("key", "value"); + String stringMap = FieldValueType.STRING.cast(new FormField<>(0, null, null, + inputMap, null, FieldValueType.MAP)); + assertEquals(inputMap.toString(), stringMap); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to String from Phone number. + */ + @Test + public void toStringFromPhoneNumber() { + String phoneNumber = "19876543210"; + String actualPhoneNumber = FieldValueType.STRING.cast(new FormField<>(0, null, null, + phoneNumber, null, FieldValueType.PHONE_NUMBER)); + assertEquals(phoneNumber, actualPhoneNumber); + } + + /** + * Test for {@link com.azure.ai.formrecognizer.models.FieldValueType#cast(FormField)} to String from List. + */ + @Test + public void toStringFromList() { + List inputList = Collections.singletonList("1"); + String actualStringList = FieldValueType.STRING.cast(new FormField<>(0, null, null, + inputList, null, FieldValueType.LIST)); + assertEquals(inputList.toString(), actualStringList); + } +} 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 4a63846663ef..5aa35327f249 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 @@ -11,7 +11,6 @@ import com.azure.ai.formrecognizer.models.OperationResult; import com.azure.ai.formrecognizer.models.RecognizeOptions; import com.azure.ai.formrecognizer.models.RecognizedForm; -import com.azure.ai.formrecognizer.models.RecognizedReceipt; import com.azure.ai.formrecognizer.training.FormTrainingAsyncClient; import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpClient; @@ -78,7 +77,7 @@ private FormTrainingAsyncClient getFormTrainingAsyncClient(HttpClient httpClient public void recognizeReceiptData(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerAsyncClient(httpClient, serviceVersion); receiptDataRunner((data, dataLength) -> { - SyncPoller> syncPoller = + SyncPoller> syncPoller = client.beginRecognizeReceipts(toFluxByteBuffer(data), dataLength, new RecognizeOptions() .setContentType(FormContentType.IMAGE_JPEG).setPollInterval(durationTestMode)) .getSyncPoller(); @@ -108,7 +107,7 @@ public void recognizeReceiptDataWithContentTypeAutoDetection(HttpClient httpClie FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerAsyncClient(httpClient, serviceVersion); - SyncPoller> syncPoller = client.beginRecognizeReceipts( + SyncPoller> syncPoller = client.beginRecognizeReceipts( getReplayableBufferData(RECEIPT_LOCAL_URL), RECEIPT_FILE_LENGTH, new RecognizeOptions() .setPollInterval(durationTestMode)).getSyncPoller(); @@ -124,7 +123,7 @@ public void recognizeReceiptDataWithContentTypeAutoDetection(HttpClient httpClie public void recognizeReceiptDataIncludeFieldElements(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerAsyncClient(httpClient, serviceVersion); receiptDataRunnerFieldElements((data, includeFieldElements) -> { - SyncPoller> syncPoller = client.beginRecognizeReceipts( + SyncPoller> syncPoller = client.beginRecognizeReceipts( toFluxByteBuffer(data), RECEIPT_FILE_LENGTH, new RecognizeOptions() .setContentType(FormContentType.IMAGE_JPEG).setIncludeFieldElements(includeFieldElements) .setPollInterval(durationTestMode)).getSyncPoller(); @@ -142,7 +141,7 @@ public void recognizeReceiptDataWithPngFile(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerAsyncClient(httpClient, serviceVersion); receiptPngDataRunnerFieldElements((data, includeFieldElements) -> { - SyncPoller> syncPoller = + SyncPoller> syncPoller = client.beginRecognizeReceipts(toFluxByteBuffer(data), RECEIPT_PNG_FILE_LENGTH, new RecognizeOptions() .setContentType(FormContentType.IMAGE_PNG).setIncludeFieldElements(includeFieldElements) .setPollInterval(durationTestMode)).getSyncPoller(); @@ -160,7 +159,7 @@ public void recognizeReceiptDataWithBlankPdf(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerAsyncClient(httpClient, serviceVersion); blankPdfDataRunner((data, dataLength) -> { - SyncPoller> syncPoller = + SyncPoller> syncPoller = client.beginRecognizeReceipts(toFluxByteBuffer(data), dataLength, new RecognizeOptions() .setContentType(FormContentType.APPLICATION_PDF).setPollInterval(durationTestMode)) .getSyncPoller(); @@ -174,7 +173,7 @@ public void recognizeReceiptDataWithBlankPdf(HttpClient httpClient, public void recognizeReceiptFromDataMultiPage(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerAsyncClient(httpClient, serviceVersion); multipageFromDataRunner((data, dataLength) -> { - SyncPoller> syncPoller = client.beginRecognizeReceipts( + SyncPoller> syncPoller = client.beginRecognizeReceipts( toFluxByteBuffer(data), dataLength, new RecognizeOptions() .setContentType(FormContentType.APPLICATION_PDF).setPollInterval(durationTestMode)) .getSyncPoller(); @@ -193,7 +192,7 @@ public void recognizeReceiptFromDataMultiPage(HttpClient httpClient, FormRecogni public void recognizeReceiptSourceUrl(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerAsyncClient(httpClient, serviceVersion); receiptSourceUrlRunner(sourceUrl -> { - SyncPoller> syncPoller = + SyncPoller> syncPoller = client.beginRecognizeReceiptsFromUrl(sourceUrl).getSyncPoller(); syncPoller.waitForCompletion(); validateReceiptResultData(syncPoller.getFinalResult(), false); @@ -227,7 +226,7 @@ public void recognizeReceiptFromUrlIncludeFieldElements(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerAsyncClient(httpClient, serviceVersion); receiptSourceUrlRunnerFieldElements((sourceUrl, includeFieldElements) -> { - SyncPoller> syncPoller = client.beginRecognizeReceiptsFromUrl( + SyncPoller> syncPoller = client.beginRecognizeReceiptsFromUrl( sourceUrl, new RecognizeOptions().setIncludeFieldElements(includeFieldElements) .setPollInterval(durationTestMode)).getSyncPoller(); syncPoller.waitForCompletion(); @@ -245,7 +244,7 @@ public void recognizeReceiptSourceUrlWithPngFile(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerAsyncClient(httpClient, serviceVersion); receiptPngSourceUrlRunnerFieldElements((sourceUrl, includeFieldElements) -> { - SyncPoller> syncPoller = client.beginRecognizeReceiptsFromUrl( + SyncPoller> syncPoller = client.beginRecognizeReceiptsFromUrl( sourceUrl, new RecognizeOptions().setIncludeFieldElements(includeFieldElements) .setPollInterval(durationTestMode)) .getSyncPoller(); @@ -259,7 +258,7 @@ sourceUrl, new RecognizeOptions().setIncludeFieldElements(includeFieldElements) public void recognizeReceiptFromUrlMultiPage(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerAsyncClient(httpClient, serviceVersion); multipageFromUrlRunner(fileUrl -> { - SyncPoller> syncPoller = client.beginRecognizeReceiptsFromUrl( + SyncPoller> syncPoller = client.beginRecognizeReceiptsFromUrl( fileUrl, new RecognizeOptions().setPollInterval(durationTestMode)).getSyncPoller(); syncPoller.waitForCompletion(); validateMultipageReceiptData(syncPoller.getFinalResult()); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormRecognizerClientTest.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormRecognizerClientTest.java index 860e06541abf..ca8741c86814 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormRecognizerClientTest.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormRecognizerClientTest.java @@ -11,7 +11,6 @@ import com.azure.ai.formrecognizer.models.OperationResult; import com.azure.ai.formrecognizer.models.RecognizeOptions; import com.azure.ai.formrecognizer.models.RecognizedForm; -import com.azure.ai.formrecognizer.models.RecognizedReceipt; import com.azure.ai.formrecognizer.training.FormTrainingClient; import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpClient; @@ -63,7 +62,7 @@ private FormTrainingClient getFormTrainingClient(HttpClient httpClient, public void recognizeReceiptData(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerClient(httpClient, serviceVersion); receiptDataRunner((data, dataLength) -> { - SyncPoller> syncPoller = + SyncPoller> syncPoller = client.beginRecognizeReceipts(data, dataLength, new RecognizeOptions() .setContentType(FormContentType.IMAGE_JPEG).setPollInterval(durationTestMode)); syncPoller.waitForCompletion(); @@ -91,7 +90,7 @@ public void recognizeReceiptDataNullData(HttpClient httpClient, public void recognizeReceiptDataWithContentTypeAutoDetection(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerClient(httpClient, serviceVersion); - SyncPoller> syncPoller = client.beginRecognizeReceipts( + SyncPoller> syncPoller = client.beginRecognizeReceipts( getContentDetectionFileData(RECEIPT_LOCAL_URL), RECEIPT_FILE_LENGTH, new RecognizeOptions() .setPollInterval(durationTestMode)); syncPoller.waitForCompletion(); @@ -107,7 +106,7 @@ public void recognizeReceiptDataWithContentTypeAutoDetection(HttpClient httpClie public void recognizeReceiptDataIncludeFieldElements(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerClient(httpClient, serviceVersion); receiptDataRunnerFieldElements((data, includeFieldElements) -> { - SyncPoller> syncPoller = client.beginRecognizeReceipts( + SyncPoller> syncPoller = client.beginRecognizeReceipts( data, RECEIPT_FILE_LENGTH, new RecognizeOptions().setContentType(FormContentType.IMAGE_JPEG) .setIncludeFieldElements(includeFieldElements).setPollInterval(durationTestMode)); syncPoller.waitForCompletion(); @@ -124,7 +123,7 @@ public void recognizeReceiptDataWithPngFile(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerClient(httpClient, serviceVersion); receiptPngDataRunnerFieldElements((data, includeFieldElements) -> { - SyncPoller> syncPoller = + SyncPoller> syncPoller = client.beginRecognizeReceipts(data, RECEIPT_PNG_FILE_LENGTH, new RecognizeOptions().setContentType( FormContentType.IMAGE_PNG).setIncludeFieldElements(includeFieldElements) .setPollInterval(durationTestMode)); @@ -142,7 +141,7 @@ public void recognizeReceiptDataWithBlankPdf(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerClient(httpClient, serviceVersion); blankPdfDataRunner((data, dataLength) -> { - SyncPoller> syncPoller = client.beginRecognizeReceipts( + SyncPoller> syncPoller = client.beginRecognizeReceipts( data, dataLength, new RecognizeOptions().setContentType(FormContentType.APPLICATION_PDF) .setPollInterval(durationTestMode)); syncPoller.waitForCompletion(); @@ -155,7 +154,7 @@ data, dataLength, new RecognizeOptions().setContentType(FormContentType.APPLICAT public void recognizeReceiptFromDataMultiPage(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerClient(httpClient, serviceVersion); multipageFromDataRunner((data, dataLength) -> { - SyncPoller> syncPoller = client.beginRecognizeReceipts( + SyncPoller> syncPoller = client.beginRecognizeReceipts( data, dataLength, new RecognizeOptions().setContentType(FormContentType.APPLICATION_PDF) .setPollInterval(durationTestMode)); syncPoller.waitForCompletion(); @@ -173,7 +172,7 @@ data, dataLength, new RecognizeOptions().setContentType(FormContentType.APPLICAT public void recognizeReceiptSourceUrl(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerClient(httpClient, serviceVersion); receiptSourceUrlRunner((sourceUrl) -> { - SyncPoller> syncPoller = + SyncPoller> syncPoller = client.beginRecognizeReceiptsFromUrl(sourceUrl); syncPoller.waitForCompletion(); validateReceiptResultData(syncPoller.getFinalResult(), false); @@ -202,7 +201,7 @@ public void recognizeReceiptFromUrlIncludeFieldElements(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerClient(httpClient, serviceVersion); receiptSourceUrlRunnerFieldElements((sourceUrl, includeFieldElements) -> { - SyncPoller> syncPoller = client.beginRecognizeReceiptsFromUrl( + SyncPoller> syncPoller = client.beginRecognizeReceiptsFromUrl( sourceUrl, new RecognizeOptions().setIncludeFieldElements(includeFieldElements) .setPollInterval(durationTestMode)); syncPoller.waitForCompletion(); @@ -220,7 +219,7 @@ public void recognizeReceiptSourceUrlWithPngFile(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerClient(httpClient, serviceVersion); receiptPngSourceUrlRunnerFieldElements((sourceUrl, includeFieldElements) -> { - SyncPoller> syncPoller = client.beginRecognizeReceiptsFromUrl( + SyncPoller> syncPoller = client.beginRecognizeReceiptsFromUrl( sourceUrl, new RecognizeOptions().setIncludeFieldElements(includeFieldElements) .setPollInterval(durationTestMode)); @@ -234,7 +233,7 @@ public void recognizeReceiptSourceUrlWithPngFile(HttpClient httpClient, public void recognizeReceiptFromUrlMultiPage(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerClient(httpClient, serviceVersion); multipageFromUrlRunner(receiptUrl -> { - SyncPoller> syncPoller = client.beginRecognizeReceiptsFromUrl( + SyncPoller> syncPoller = client.beginRecognizeReceiptsFromUrl( receiptUrl, new RecognizeOptions().setPollInterval(durationTestMode)); syncPoller.waitForCompletion(); validateMultipageReceiptData(syncPoller.getFinalResult()); @@ -411,7 +410,7 @@ public void recognizeCustomFormLabeledDataWithJpgContentType(HttpClient httpClie beginTrainingLabeledRunner((trainingFilesUrl, useTrainingLabels) -> { SyncPoller trainingPoller = getFormTrainingClient(httpClient, serviceVersion).beginTraining(trainingFilesUrl, useTrainingLabels, - null, durationTestMode); + null, durationTestMode); trainingPoller.waitForCompletion(); SyncPoller> syncPoller = client.beginRecognizeCustomForms( diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormRecognizerClientTestBase.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormRecognizerClientTestBase.java index 31c0cf01d633..4fa322aff744 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormRecognizerClientTestBase.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormRecognizerClientTestBase.java @@ -16,6 +16,7 @@ import com.azure.ai.formrecognizer.implementation.models.TextLine; import com.azure.ai.formrecognizer.implementation.models.TextWord; import com.azure.ai.formrecognizer.models.BoundingBox; +import com.azure.ai.formrecognizer.models.FieldValueType; import com.azure.ai.formrecognizer.models.FormElement; import com.azure.ai.formrecognizer.models.FormField; import com.azure.ai.formrecognizer.models.FormLine; @@ -26,7 +27,6 @@ import com.azure.ai.formrecognizer.models.FormWord; import com.azure.ai.formrecognizer.models.Point; import com.azure.ai.formrecognizer.models.RecognizedForm; -import com.azure.ai.formrecognizer.models.RecognizedReceipt; import com.azure.ai.formrecognizer.training.FormTrainingClientBuilder; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.http.HttpClient; @@ -253,7 +253,8 @@ private static void validateBoundingBoxData(List expectedBoundingBox, Bou } } - private static void validateFieldValueTransforms(FieldValue expectedFieldValue, FormField actualFormField, + @SuppressWarnings("unchecked") + private static void validateFieldValueTransforms(FieldValue expectedFieldValue, FormField actualFormField, List readResults, boolean includeFieldElements) { if (expectedFieldValue != null) { if (expectedFieldValue.getBoundingBox() != null) { @@ -266,35 +267,35 @@ private static void validateFieldValueTransforms(FieldValue expectedFieldValue, } switch (expectedFieldValue.getType()) { case NUMBER: - assertEquals(expectedFieldValue.getValueNumber(), actualFormField.getFieldValue().asFloat()); + assertEquals(expectedFieldValue.getValueNumber(), FieldValueType.DOUBLE.cast(actualFormField)); break; case DATE: - assertEquals(expectedFieldValue.getValueDate(), actualFormField.getFieldValue().asDate()); + assertEquals(expectedFieldValue.getValueDate(), FieldValueType.DATE.cast(actualFormField)); break; case TIME: assertEquals(LocalTime.parse(expectedFieldValue.getValueTime(), - DateTimeFormatter.ofPattern("HH:mm:ss")), actualFormField.getFieldValue().asTime()); + DateTimeFormatter.ofPattern("HH:mm:ss")), FieldValueType.TIME.cast(actualFormField)); break; case STRING: - assertEquals(expectedFieldValue.getValueString(), actualFormField.getFieldValue().asString()); + assertEquals(expectedFieldValue.getValueString(), FieldValueType.STRING.cast(actualFormField)); break; case INTEGER: - assertEquals(expectedFieldValue.getValueInteger(), actualFormField.getFieldValue().asInteger()); + assertEquals(expectedFieldValue.getValueInteger(), FieldValueType.LONG.cast(actualFormField)); break; case PHONE_NUMBER: - assertEquals(expectedFieldValue.getValuePhoneNumber(), actualFormField.getFieldValue().asPhoneNumber()); + assertEquals(expectedFieldValue.getValuePhoneNumber(), FieldValueType.PHONE_NUMBER.cast(actualFormField)); break; case OBJECT: expectedFieldValue.getValueObject().forEach((key, fieldValue) -> { - FormField actualFormFieldValue = actualFormField.getFieldValue().asMap().get(key); + FormField actualFormFieldValue = ((Map>) actualFormField.getValue()).get(key); validateFieldValueTransforms(fieldValue, actualFormFieldValue, readResults, includeFieldElements); }); break; case ARRAY: - assertEquals(expectedFieldValue.getValueArray().size(), actualFormField.getFieldValue().asList().size()); + assertEquals(expectedFieldValue.getValueArray().size(), ((List>) actualFormField.getValue()).size()); for (int i = 0; i < expectedFieldValue.getValueArray().size(); i++) { FieldValue expectedReceiptItem = expectedFieldValue.getValueArray().get(i); - FormField actualReceiptItem = actualFormField.getFieldValue().asList().get(i); + FormField actualReceiptItem = ((List>) actualFormField.getValue()).get(i); validateFieldValueTransforms(expectedReceiptItem, actualReceiptItem, readResults, includeFieldElements); } break; @@ -492,14 +493,14 @@ abstract void recognizeCustomFormUrlMultiPageLabeled(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion); // Receipt - void validateReceiptDataFields(Map actualRecognizedReceiptFields, boolean includeFieldElements) { + void validateReceiptDataFields(Map> actualRecognizedReceiptFields, boolean includeFieldElements) { final AnalyzeResult analyzeResult = getAnalyzeRawResponse().getAnalyzeResult(); List readResults = analyzeResult.getReadResults(); DocumentResult documentResult = analyzeResult.getDocumentResults().get(0); Map expectedReceiptFields = documentResult.getFields(); assertEquals(expectedReceiptFields.get("ReceiptType").getValueString(), - actualRecognizedReceiptFields.get("ReceiptType").getFieldValue().asString()); + FieldValueType.STRING.cast(actualRecognizedReceiptFields.get("ReceiptType"))); assertEquals(expectedReceiptFields.get("ReceiptType").getConfidence(), actualRecognizedReceiptFields.get("ReceiptType").getConfidence()); validateFieldValueTransforms(expectedReceiptFields.get("MerchantName"), @@ -547,20 +548,20 @@ void validateContentResultData(List actualFormPageList, boolean includ } } - void validateReceiptResultData(List actualReceiptList, boolean includeFieldElements) { + void validateReceiptResultData(List actualReceiptList, boolean includeFieldElements) { final AnalyzeResult rawResponse = getAnalyzeRawResponse().getAnalyzeResult(); for (int i = 0; i < actualReceiptList.size(); i++) { - final RecognizedReceipt actualReceipt = actualReceiptList.get(i); - validateLabeledData(actualReceipt.getRecognizedForm(), includeFieldElements, rawResponse.getReadResults(), + final RecognizedForm actualReceipt = actualReceiptList.get(i); + validateLabeledData(actualReceipt, includeFieldElements, rawResponse.getReadResults(), rawResponse.getDocumentResults().get(i)); - validateReceiptDataFields(actualReceipt.getRecognizedForm().getFields(), includeFieldElements); + validateReceiptDataFields(actualReceipt.getFields(), includeFieldElements); } } - void validateBlankPdfResultData(List actualReceiptList) { + void validateBlankPdfResultData(List actualReceiptList) { assertEquals(1, actualReceiptList.size()); - final RecognizedReceipt actualReceipt = actualReceiptList.get(0); - assertTrue(actualReceipt.getRecognizedForm().getFields().isEmpty()); + final RecognizedForm actualReceipt = actualReceiptList.get(0); + assertTrue(actualReceipt.getFields().isEmpty()); } void validateRecognizedResult(List actualFormList, boolean includeFieldElements, @@ -697,7 +698,7 @@ private void validateUnLabeledResult(RecognizedForm actualForm, boolean includeF validatePageRangeData(expectedPage.getPage(), actualForm.getFormPageRange()); for (int i = 0; i < expectedPage.getKeyValuePairs().size(); i++) { final KeyValuePair expectedFormField = expectedPage.getKeyValuePairs().get(i); - final FormField actualFormField = actualForm.getFields().get("field-" + i); + final FormField actualFormField = actualForm.getFields().get("field-" + i); assertEquals(expectedFormField.getConfidence(), actualFormField.getConfidence()); assertEquals(expectedFormField.getKey().getText(), actualFormField.getLabelData().getText()); validateBoundingBoxData(expectedFormField.getKey().getBoundingBox(), @@ -720,7 +721,7 @@ private void validateLabeledData(RecognizedForm actualForm, boolean includeField assertEquals(documentResult.getPageRange().get(0), actualForm.getFormPageRange().getFirstPageNumber()); assertEquals(documentResult.getPageRange().get(1), actualForm.getFormPageRange().getLastPageNumber()); documentResult.getFields().forEach((label, expectedFieldValue) -> { - final FormField actualFormField = actualForm.getFields().get(label); + final FormField actualFormField = actualForm.getFields().get(label); assertEquals(label, actualFormField.getName()); if (expectedFieldValue != null) { if (expectedFieldValue.getConfidence() != null) { @@ -741,7 +742,7 @@ static void validateMultiPageDataLabeled(List actualRecognizedFo assertEquals(3, recognizedForm.getPages().size()); recognizedForm.getFields().forEach((label, formField) -> { assertNotNull(formField.getName()); - assertNotNull(formField.getFieldValue()); + assertNotNull(formField.getValue()); assertNotNull(formField.getValueData().getText()); assertNotNull(formField.getLabelData().getText()); }); @@ -751,34 +752,35 @@ static void validateMultiPageDataLabeled(List actualRecognizedFo static void validateMultiPageDataUnlabeled(List actualRecognizedFormsList) { actualRecognizedFormsList.forEach(recognizedForm -> { assertNotNull(recognizedForm.getFormType()); - assertEquals(1, recognizedForm.getPages().stream().count()); + assertEquals(1, (long) recognizedForm.getPages().size()); recognizedForm.getFields().forEach((label, formField) -> { assertNotNull(formField.getName()); - assertNotNull(formField.getFieldValue()); + assertNotNull(formField.getValue()); assertNotNull(formField.getValueData().getText()); assertNotNull(formField.getLabelData().getText()); + }); }); } - static void validateMultipageReceiptData(List recognizedReceipts) { + static void validateMultipageReceiptData(List recognizedReceipts) { assertEquals(3, recognizedReceipts.size()); - RecognizedForm receiptPage1 = recognizedReceipts.get(0).getRecognizedForm(); - RecognizedForm receiptPage2 = recognizedReceipts.get(1).getRecognizedForm(); - RecognizedForm receiptPage3 = recognizedReceipts.get(2).getRecognizedForm(); + RecognizedForm receiptPage1 = recognizedReceipts.get(0); + RecognizedForm receiptPage2 = recognizedReceipts.get(1); + RecognizedForm receiptPage3 = recognizedReceipts.get(2); assertEquals(1, receiptPage1.getFormPageRange().getFirstPageNumber()); assertEquals(1, receiptPage1.getFormPageRange().getLastPageNumber()); - Map receiptPage1Fields = receiptPage1.getFields(); + Map> receiptPage1Fields = receiptPage1.getFields(); assertEquals(EXPECTED_MULTIPAGE_ADDRESS_VALUE, receiptPage1Fields.get("MerchantAddress") - .getFieldValue().asString()); + .getValue()); assertEquals("Bilbo Baggins", receiptPage1Fields.get("MerchantName") - .getFieldValue().asString()); + .getValue()); assertEquals(EXPECTED_MULTIPAGE_PHONE_NUMBER_VALUE, receiptPage1Fields.get("MerchantPhoneNumber") - .getFieldValue().asPhoneNumber()); - assertNotNull(receiptPage1Fields.get("Total").getFieldValue().asFloat()); + .getValue()); + assertNotNull(receiptPage1Fields.get("Total").getValue()); assertNotNull(receiptPage1.getPages()); - assertEquals(ITEMIZED_RECEIPT_VALUE, receiptPage1Fields.get("ReceiptType").getFieldValue().asString()); + assertEquals(ITEMIZED_RECEIPT_VALUE, receiptPage1Fields.get("ReceiptType").getValue()); // Assert no fields, tables and lines on second page assertEquals(0, receiptPage2.getFields().size()); @@ -791,18 +793,15 @@ static void validateMultipageReceiptData(List recognizedRecei assertEquals(3, receiptPage3.getFormPageRange().getFirstPageNumber()); assertEquals(3, receiptPage3.getFormPageRange().getLastPageNumber()); - Map receiptPage3Fields = receiptPage3.getFields(); - assertEquals(EXPECTED_MULTIPAGE_ADDRESS_VALUE, receiptPage3Fields.get("MerchantAddress") - .getFieldValue().asString()); - assertEquals("Frodo Baggins", receiptPage3Fields.get("MerchantName") - .getFieldValue().asString()); - assertEquals(EXPECTED_MULTIPAGE_PHONE_NUMBER_VALUE, receiptPage3Fields.get("MerchantPhoneNumber") - .getFieldValue().asPhoneNumber()); - assertNotNull(receiptPage3Fields.get("Total").getFieldValue().asFloat()); + Map> receiptPage3Fields = receiptPage3.getFields(); + assertEquals(EXPECTED_MULTIPAGE_ADDRESS_VALUE, FieldValueType.STRING.cast(receiptPage3Fields.get("MerchantAddress"))); + assertEquals("Frodo Baggins", FieldValueType.STRING.cast(receiptPage3Fields.get("MerchantName"))); + assertEquals(EXPECTED_MULTIPAGE_PHONE_NUMBER_VALUE, FieldValueType.PHONE_NUMBER.cast(receiptPage3Fields.get("MerchantPhoneNumber"))); + assertNotNull(receiptPage3Fields.get("Total").getValue()); // why isn't tip returned by service? // total value 1000 returned by service but should be 4300, service bug - assertEquals(3000.0f, receiptPage3Fields.get("Subtotal").getFieldValue().asFloat()); - assertEquals(ITEMIZED_RECEIPT_VALUE, receiptPage3Fields.get("ReceiptType").getFieldValue().asString()); + assertEquals(3000.0f, (Float) receiptPage3Fields.get("Subtotal").getValue()); + assertEquals(ITEMIZED_RECEIPT_VALUE, FieldValueType.STRING.cast(receiptPage3Fields.get("ReceiptType"))); } protected String getEndpoint() { 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 7d660cffb838..804537d907f1 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 @@ -12,7 +12,7 @@ import com.azure.ai.formrecognizer.models.FormRecognizerException; import com.azure.ai.formrecognizer.models.OperationResult; import com.azure.ai.formrecognizer.models.RecognizeOptions; -import com.azure.ai.formrecognizer.models.RecognizedReceipt; +import com.azure.ai.formrecognizer.models.RecognizedForm; import com.azure.ai.formrecognizer.models.TrainingFileFilter; import com.azure.ai.formrecognizer.training.FormTrainingAsyncClient; import com.azure.core.exception.HttpResponseException; @@ -70,7 +70,7 @@ void getFormRecognizerClientAndValidate(HttpClient httpClient, FormRecognizerSer FormRecognizerAsyncClient formRecognizerClient = getFormTrainingAsyncClient(httpClient, serviceVersion) .getFormRecognizerAsyncClient(); blankPdfDataRunner(data -> { - SyncPoller> syncPoller = + SyncPoller> syncPoller = formRecognizerClient.beginRecognizeReceipts(toFluxByteBuffer(data), BLANK_FORM_FILE_LENGTH, new RecognizeOptions() .setContentType(FormContentType.APPLICATION_PDF) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormTrainingClientTest.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormTrainingClientTest.java index beb6aa4bd0fd..340889097b86 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormTrainingClientTest.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormTrainingClientTest.java @@ -13,7 +13,7 @@ import com.azure.ai.formrecognizer.models.FormRecognizerException; import com.azure.ai.formrecognizer.models.OperationResult; import com.azure.ai.formrecognizer.models.RecognizeOptions; -import com.azure.ai.formrecognizer.models.RecognizedReceipt; +import com.azure.ai.formrecognizer.models.RecognizedForm; import com.azure.ai.formrecognizer.models.TrainingFileFilter; import com.azure.ai.formrecognizer.training.FormTrainingClient; import com.azure.core.exception.HttpResponseException; @@ -55,7 +55,7 @@ public void getFormRecognizerClientAndValidate(HttpClient httpClient, FormRecogn FormRecognizerClient formRecognizerClient = getFormTrainingClient(httpClient, serviceVersion) .getFormRecognizerClient(); blankPdfDataRunner(data -> { - SyncPoller> syncPoller = + SyncPoller> syncPoller = formRecognizerClient.beginRecognizeReceipts(data, BLANK_FORM_FILE_LENGTH, new RecognizeOptions() .setContentType(FormContentType.APPLICATION_PDF).setPollInterval(durationTestMode)); syncPoller.waitForCompletion(); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormTrainingClientTestBase.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormTrainingClientTestBase.java index cc3ed0e43fd8..3ce2fd70e2a5 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormTrainingClientTestBase.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormTrainingClientTestBase.java @@ -12,7 +12,7 @@ import com.azure.ai.formrecognizer.models.CustomFormSubmodel; import com.azure.ai.formrecognizer.models.ErrorInformation; import com.azure.ai.formrecognizer.models.FormRecognizerError; -import com.azure.ai.formrecognizer.models.RecognizedReceipt; +import com.azure.ai.formrecognizer.models.RecognizedForm; import com.azure.ai.formrecognizer.models.TrainingDocumentInfo; import com.azure.ai.formrecognizer.training.FormTrainingClientBuilder; import com.azure.core.credential.AzureKeyCredential; @@ -348,10 +348,10 @@ String getEndpoint() { : Configuration.getGlobalConfiguration().get(AZURE_FORM_RECOGNIZER_ENDPOINT); } - void validateBlankPdfResultData(List actualReceiptList) { + void validateBlankPdfResultData(List actualReceiptList) { assertEquals(1, actualReceiptList.size()); - final RecognizedReceipt actualReceipt = actualReceiptList.get(0); - assertTrue(actualReceipt.getRecognizedForm().getFields().isEmpty()); + final RecognizedForm actualReceipt = actualReceiptList.get(0); + assertTrue(actualReceipt.getFields().isEmpty()); } void blankPdfDataRunner(Consumer testRunner) { diff --git a/sdk/identity/azure-identity/pom.xml b/sdk/identity/azure-identity/pom.xml index a92587fe3aa7..80e2d8082866 100644 --- a/sdk/identity/azure-identity/pom.xml +++ b/sdk/identity/azure-identity/pom.xml @@ -27,7 +27,7 @@ com.azure azure-core - 1.7.0-beta.1 + 1.7.0-beta.1 com.microsoft.azure diff --git a/sdk/keyvault/azure-security-keyvault-certificates/pom.xml b/sdk/keyvault/azure-security-keyvault-certificates/pom.xml index 91e062ccab1c..ea7af67bbf63 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/pom.xml +++ b/sdk/keyvault/azure-security-keyvault-certificates/pom.xml @@ -36,7 +36,7 @@ com.azure azure-core - 1.6.0 + 1.7.0-beta.1 @@ -98,7 +98,7 @@ com.azure azure-identity - 1.0.7 + 1.0.8 test diff --git a/sdk/keyvault/azure-security-keyvault-keys/pom.xml b/sdk/keyvault/azure-security-keyvault-keys/pom.xml index 598fcabd84ef..f1ce06a6161c 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/pom.xml +++ b/sdk/keyvault/azure-security-keyvault-keys/pom.xml @@ -50,7 +50,7 @@ com.azure azure-core - 1.6.0 + 1.7.0-beta.1 @@ -105,7 +105,7 @@ com.azure azure-identity - 1.0.7 + 1.0.8 test diff --git a/sdk/keyvault/azure-security-keyvault-secrets/pom.xml b/sdk/keyvault/azure-security-keyvault-secrets/pom.xml index 7ae99e90d3b2..0ae45a0c2f51 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/pom.xml +++ b/sdk/keyvault/azure-security-keyvault-secrets/pom.xml @@ -47,7 +47,7 @@ com.azure azure-core - 1.6.0 + 1.7.0-beta.1 @@ -105,7 +105,7 @@ com.azure azure-identity - 1.0.7 + 1.0.8 test diff --git a/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/KeyVaultManagementClient.java b/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/KeyVaultManagementClient.java index 7087cb2f411f..08385e8b095c 100644 --- a/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/KeyVaultManagementClient.java +++ b/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/KeyVaultManagementClient.java @@ -8,7 +8,7 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.management.AzureEnvironment; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.AzureServiceClient; +import com.azure.resourcemanager.resources.fluentcore.AzureServiceClient; import com.azure.resourcemanager.keyvault.fluent.OperationsClient; import com.azure.resourcemanager.keyvault.fluent.PrivateEndpointConnectionsClient; import com.azure.resourcemanager.keyvault.fluent.PrivateLinkResourcesClient; diff --git a/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/implementation/KeyImpl.java b/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/implementation/KeyImpl.java index bbc6140963cf..e2f10cf60ac1 100644 --- a/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/implementation/KeyImpl.java +++ b/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/implementation/KeyImpl.java @@ -23,6 +23,7 @@ import com.azure.security.keyvault.keys.models.CreateRsaKeyOptions; import com.azure.security.keyvault.keys.models.ImportKeyOptions; import com.azure.security.keyvault.keys.models.JsonWebKey; +import com.azure.security.keyvault.keys.models.KeyCurveName; import com.azure.security.keyvault.keys.models.KeyOperation; import com.azure.security.keyvault.keys.models.KeyProperties; import com.azure.security.keyvault.keys.models.KeyType; @@ -345,13 +346,17 @@ public KeyImpl withHsm(boolean isHsm) { @Override public KeyImpl withKeySize(int size) { - // TODO (weidxu) currently no setKeySize in CreateEcKeyOptions - /*if (createKeyRequest instanceof CreateEcKeyOptions) { - ((CreateEcKeyOptions) createKeyRequest).setKeySize(size); - } else */ if (createKeyRequest instanceof CreateRsaKeyOptions) { ((CreateRsaKeyOptions) createKeyRequest).setKeySize(size); } return this; } + + @Override + public DefinitionStages.WithCreate withKeyCurveName(KeyCurveName keyCurveName) { + if (createKeyRequest instanceof CreateEcKeyOptions) { + ((CreateEcKeyOptions) createKeyRequest).setCurveName(keyCurveName); + } + return this; + } } diff --git a/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/implementation/VaultImpl.java b/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/implementation/VaultImpl.java index d2d028be841d..2620419164d2 100644 --- a/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/implementation/VaultImpl.java +++ b/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/implementation/VaultImpl.java @@ -20,6 +20,7 @@ import com.azure.resourcemanager.keyvault.models.NetworkRuleSet; import com.azure.resourcemanager.keyvault.models.Secrets; import com.azure.resourcemanager.keyvault.models.Sku; +import com.azure.resourcemanager.keyvault.models.SkuFamily; import com.azure.resourcemanager.keyvault.models.SkuName; import com.azure.resourcemanager.keyvault.models.Vault; import com.azure.resourcemanager.keyvault.models.VaultCreateOrUpdateParameters; @@ -283,7 +284,7 @@ public VaultImpl withSku(SkuName skuName) { if (inner().properties() == null) { inner().withProperties(new VaultProperties()); } - inner().properties().withSku(new Sku().withName(skuName)); + inner().properties().withSku(new Sku().withName(skuName).withFamily(SkuFamily.A)); return this; } diff --git a/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/implementation/VaultsImpl.java b/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/implementation/VaultsImpl.java index 8c17e1a868b4..c3a5fc3ea78f 100644 --- a/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/implementation/VaultsImpl.java +++ b/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/implementation/VaultsImpl.java @@ -14,6 +14,7 @@ import com.azure.resourcemanager.keyvault.models.CreateMode; import com.azure.resourcemanager.keyvault.models.DeletedVault; import com.azure.resourcemanager.keyvault.models.Sku; +import com.azure.resourcemanager.keyvault.models.SkuFamily; import com.azure.resourcemanager.keyvault.models.SkuName; import com.azure.resourcemanager.keyvault.models.Vault; import com.azure.resourcemanager.keyvault.models.VaultCreateOrUpdateParameters; @@ -145,7 +146,7 @@ public Mono recoverSoftDeletedVaultAsync( .withProperties( new VaultProperties() .withCreateMode(CreateMode.RECOVER) - .withSku(new Sku().withName(SkuName.STANDARD)) + .withSku(new Sku().withName(SkuName.STANDARD).withFamily(SkuFamily.A)) .withTenantId(UUID.fromString(tenantId))); return inner() .createOrUpdateAsync(resourceGroupName, vaultName, parameters) diff --git a/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/models/AccessPolicy.java b/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/models/AccessPolicy.java index 73ad9eade808..8ed618c5e473 100644 --- a/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/models/AccessPolicy.java +++ b/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/models/AccessPolicy.java @@ -385,6 +385,29 @@ interface WithPermissions { */ WithAttach allowStorageAllPermissions(); + /** + * Allow all permissions for the AD identity to access certificates. + * + * @return the next stage of access policy definition + */ + WithAttach allowCertificateAllPermissions(); + + /** + * Allow a list of permissions for the AD identity to access certificates. + * + * @param permissions the list of permissions allowed + * @return the next stage of access policy definition + */ + WithAttach allowCertificatePermissions(CertificatePermissions... permissions); + + /** + * Allow a list of permissions for the AD identity to access certificates. + * + * @param permissions the list of permissions allowed + * @return the next stage of access policy definition + */ + WithAttach allowCertificatePermissions(List permissions); + /** * Allow a list of permissions for the AD identity to access storage. * diff --git a/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/models/Key.java b/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/models/Key.java index 2dd3bf31377c..6f97cf97f063 100644 --- a/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/models/Key.java +++ b/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/models/Key.java @@ -16,6 +16,7 @@ import com.azure.security.keyvault.keys.cryptography.models.KeyWrapAlgorithm; import com.azure.security.keyvault.keys.cryptography.models.SignatureAlgorithm; import com.azure.security.keyvault.keys.models.JsonWebKey; +import com.azure.security.keyvault.keys.models.KeyCurveName; import com.azure.security.keyvault.keys.models.KeyOperation; import com.azure.security.keyvault.keys.models.KeyProperties; import com.azure.security.keyvault.keys.models.KeyType; @@ -198,12 +199,20 @@ interface WithKey { /** The stage of a key definition allowing to specify the key size. */ interface WithKeySize { /** - * Specifies the size of the key to create. + * Specifies the size of the RSA key to create. * * @param size the size of the key in integer * @return the next stage of the definition */ WithCreate withKeySize(int size); + + /** + * Specifies the name of the key curve for elliptic-curve key to create. + * + * @param keyCurveName name of the key curve + * @return the next stage of the definition + */ + WithCreate withKeyCurveName(KeyCurveName keyCurveName); } /** The stage of a key definition allowing to specify the allowed operations for the key. */ diff --git a/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/models/Sku.java b/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/models/Sku.java index ee6cb828e8e6..868277d14426 100644 --- a/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/models/Sku.java +++ b/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/models/Sku.java @@ -18,7 +18,7 @@ public final class Sku { * SKU family name */ @JsonProperty(value = "family", required = true) - private String family; + private SkuFamily family; /* * SKU name to specify whether the key vault is a standard vault or a @@ -27,17 +27,12 @@ public final class Sku { @JsonProperty(value = "name", required = true) private SkuName name; - /** Creates an instance of Sku class. */ - public Sku() { - family = "A"; - } - /** * Get the family property: SKU family name. * * @return the family value. */ - public String family() { + public SkuFamily family() { return this.family; } @@ -47,7 +42,7 @@ public String family() { * @param family the family value to set. * @return the Sku object itself. */ - public Sku withFamily(String family) { + public Sku withFamily(SkuFamily family) { this.family = family; return this; } @@ -78,6 +73,10 @@ public Sku withName(SkuName name) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (family() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property family in model Sku")); + } if (name() == null) { throw logger .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Sku")); diff --git a/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/models/SkuFamily.java b/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/models/SkuFamily.java new file mode 100644 index 000000000000..13a0401af6b3 --- /dev/null +++ b/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/models/SkuFamily.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.keyvault.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SkuFamily. */ +public final class SkuFamily extends ExpandableStringEnum { + /** Static value A for SkuFamily. */ + public static final SkuFamily A = fromString("A"); + + /** + * Creates or finds a SkuFamily from its string representation. + * + * @param name a name to look for. + * @return the corresponding SkuFamily. + */ + @JsonCreator + public static SkuFamily fromString(String name) { + return fromString(name, SkuFamily.class); + } + + /** @return known SkuFamily values. */ + public static Collection values() { + return values(SkuFamily.class); + } +} diff --git a/sdk/keyvault/mgmt/src/test/java/com/azure/resourcemanager/keyvault/KeyTests.java b/sdk/keyvault/mgmt/src/test/java/com/azure/resourcemanager/keyvault/KeyTests.java index fad99351bd84..032e5acec18c 100644 --- a/sdk/keyvault/mgmt/src/test/java/com/azure/resourcemanager/keyvault/KeyTests.java +++ b/sdk/keyvault/mgmt/src/test/java/com/azure/resourcemanager/keyvault/KeyTests.java @@ -14,6 +14,7 @@ import com.azure.security.keyvault.keys.cryptography.models.KeyWrapAlgorithm; import com.azure.security.keyvault.keys.cryptography.models.SignatureAlgorithm; import com.azure.security.keyvault.keys.models.JsonWebKey; +import com.azure.security.keyvault.keys.models.KeyCurveName; import com.azure.security.keyvault.keys.models.KeyOperation; import com.azure.security.keyvault.keys.models.KeyType; import java.security.KeyPair; @@ -74,6 +75,33 @@ public void canCRUDKey() throws Exception { // List versions Iterable keys = key.listVersions(); Assertions.assertEquals(2, TestUtilities.getSize(keys)); + + // Create RSA key with size + key = vault + .keys() + .define(keyName) + .withKeyTypeToCreate(KeyType.RSA) + .withKeyOperations(KeyOperation.SIGN, KeyOperation.VERIFY) + .withKeySize(2048) + .create(); + + Assertions.assertNotNull(key); + Assertions.assertNotNull(key.id()); + Assertions.assertEquals(KeyType.RSA, key.getJsonWebKey().getKeyType()); + + // Create EC key with curve + key = vault + .keys() + .define(keyName) + .withKeyTypeToCreate(KeyType.EC) + .withKeyOperations(KeyOperation.SIGN, KeyOperation.VERIFY) + .withKeyCurveName(KeyCurveName.P_521) + .create(); + + Assertions.assertNotNull(key); + Assertions.assertNotNull(key.id()); + Assertions.assertEquals(KeyType.EC, key.getJsonWebKey().getKeyType()); + Assertions.assertEquals(KeyCurveName.P_521, key.getJsonWebKey().getCurveName()); } @Test diff --git a/sdk/managedserviceidentity/mgmt/src/main/java/com/azure/resourcemanager/msi/ManagedServiceIdentityClient.java b/sdk/managedserviceidentity/mgmt/src/main/java/com/azure/resourcemanager/msi/ManagedServiceIdentityClient.java index 43a5c1f9c6eb..fb7ecbe32f5b 100644 --- a/sdk/managedserviceidentity/mgmt/src/main/java/com/azure/resourcemanager/msi/ManagedServiceIdentityClient.java +++ b/sdk/managedserviceidentity/mgmt/src/main/java/com/azure/resourcemanager/msi/ManagedServiceIdentityClient.java @@ -8,7 +8,7 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.management.AzureEnvironment; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.AzureServiceClient; +import com.azure.resourcemanager.resources.fluentcore.AzureServiceClient; import com.azure.resourcemanager.msi.fluent.OperationsClient; import com.azure.resourcemanager.msi.fluent.SystemAssignedIdentitiesClient; import com.azure.resourcemanager.msi.fluent.UserAssignedIdentitiesClient; diff --git a/sdk/management/README.md b/sdk/management/README.md index 58b701bf4210..647a346676d1 100644 --- a/sdk/management/README.md +++ b/sdk/management/README.md @@ -3,8 +3,16 @@ The Azure Management Libraries for Java is a higher-level, object-oriented API for *managing* Azure resources, that is optimized for ease of use, succinctness and consistency. -- [API reference documentation][docs] -- [Code snippets and samples][sample] +## Documentation + +Various documentation is available to help you get started + +- **[API reference documentation][docs]** +- **[Code snippets and samples][sample]** + +## Migration from older version of Azure management library + +If you are an existing user of the older version of Azure management library for Java (the namespace of old packages contains ``com.microsoft.azure.management.**``) and you are looking for a migration guide to the new version of the SDK, please refer to [this migration guide here](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/management/docs/MIGRATION_GUIDE.md) ## Getting started diff --git a/sdk/management/api-specs.json b/sdk/management/api-specs.json index 7f9b79ac4079..0823f6bb2fed 100644 --- a/sdk/management/api-specs.json +++ b/sdk/management/api-specs.json @@ -11,6 +11,12 @@ "package": "com.microsoft.azure.resourcemanager.apimanagement", "args": "--payload-flattening-threshold=1 --tag=package-2018-01" }, + "appplatform": { + "dir": "../appplatform/mgmt", + "source": "specification/appplatform/resource-manager/readme.md", + "package": "com.azure.resourcemanager.appplatform", + "args": "--payload-flattening-threshold=1 --tag=package-2019-05-01-preview --remove-inner=TestKeys,ResourceSku,ResourceUploadDefinition" + }, "appservice": { "dir": "../appservice/mgmt", "source": "specification/web/resource-manager/readme.md", @@ -217,7 +223,8 @@ "policy": { "dir": "../resources/mgmt", "source": "specification/resources/resource-manager/readme.md", - "package": "com.azure.resourcemanager.resources --tag=package-policy-2019-09" + "package": "com.azure.resourcemanager.resources", + "args": "--payload-flattening-threshold=1 --tag=package-policy-2019-09" }, "powerbi": { "dir": "../powerbi/mgmt", diff --git a/sdk/management/azure/pom.xml b/sdk/management/azure/pom.xml index 1e4a730318a9..47f589875697 100644 --- a/sdk/management/azure/pom.xml +++ b/sdk/management/azure/pom.xml @@ -16,7 +16,7 @@ jar Microsoft Azure SDK - This package contains Microsoft Azure SDK. + This package contains Microsoft Azure SDK. For documentation on how to use this package, please see https://aka.ms/azure-sdk-java-mgmt https://github.com/Azure/azure-sdk-for-java @@ -116,6 +116,11 @@ azure-resourcemanager-dns 2.0.0-SNAPSHOT + + com.azure.resourcemanager + azure-resourcemanager-appplatform + 2.0.0-SNAPSHOT + org.junit.jupiter junit-jupiter-engine diff --git a/sdk/management/azure/src/main/java/com/azure/resourcemanager/Azure.java b/sdk/management/azure/src/main/java/com/azure/resourcemanager/Azure.java index a5f753171e50..8e0c14d820db 100644 --- a/sdk/management/azure/src/main/java/com/azure/resourcemanager/Azure.java +++ b/sdk/management/azure/src/main/java/com/azure/resourcemanager/Azure.java @@ -6,13 +6,15 @@ import com.azure.core.credential.TokenCredential; import com.azure.core.http.HttpPipeline; import com.azure.core.management.AzureEnvironment; +import com.azure.resourcemanager.appplatform.AppPlatformManager; +import com.azure.resourcemanager.appplatform.models.SpringServices; +import com.azure.resourcemanager.appservice.AppServiceManager; import com.azure.resourcemanager.appservice.models.AppServiceCertificateOrders; import com.azure.resourcemanager.appservice.models.AppServiceCertificates; import com.azure.resourcemanager.appservice.models.AppServiceDomains; import com.azure.resourcemanager.appservice.models.AppServicePlans; import com.azure.resourcemanager.appservice.models.FunctionApps; import com.azure.resourcemanager.appservice.models.WebApps; -import com.azure.resourcemanager.appservice.AppServiceManager; import com.azure.resourcemanager.authorization.AuthorizationManager; import com.azure.resourcemanager.authorization.models.ActiveDirectoryApplications; import com.azure.resourcemanager.authorization.models.ActiveDirectoryGroups; @@ -41,19 +43,20 @@ import com.azure.resourcemanager.containerservice.models.KubernetesClusters; import com.azure.resourcemanager.cosmos.CosmosManager; import com.azure.resourcemanager.cosmos.models.CosmosDBAccounts; -import com.azure.resourcemanager.dns.models.DnsZones; import com.azure.resourcemanager.dns.DnsZoneManager; -import com.azure.resourcemanager.keyvault.models.Vaults; +import com.azure.resourcemanager.dns.models.DnsZones; import com.azure.resourcemanager.keyvault.KeyVaultManager; +import com.azure.resourcemanager.keyvault.models.Vaults; +import com.azure.resourcemanager.monitor.MonitorManager; import com.azure.resourcemanager.monitor.models.ActionGroups; import com.azure.resourcemanager.monitor.models.ActivityLogs; import com.azure.resourcemanager.monitor.models.AlertRules; import com.azure.resourcemanager.monitor.models.AutoscaleSettings; import com.azure.resourcemanager.monitor.models.DiagnosticSettings; import com.azure.resourcemanager.monitor.models.MetricDefinitions; -import com.azure.resourcemanager.monitor.MonitorManager; -import com.azure.resourcemanager.msi.models.Identities; import com.azure.resourcemanager.msi.MSIManager; +import com.azure.resourcemanager.msi.models.Identities; +import com.azure.resourcemanager.network.NetworkManager; import com.azure.resourcemanager.network.models.ApplicationGateways; import com.azure.resourcemanager.network.models.ApplicationSecurityGroups; import com.azure.resourcemanager.network.models.DdosProtectionPlans; @@ -71,7 +74,6 @@ import com.azure.resourcemanager.network.models.RouteFilters; import com.azure.resourcemanager.network.models.RouteTables; import com.azure.resourcemanager.network.models.VirtualNetworkGateways; -import com.azure.resourcemanager.network.NetworkManager; import com.azure.resourcemanager.resources.ResourceManager; import com.azure.resourcemanager.resources.fluentcore.arm.AzureConfigurable; import com.azure.resourcemanager.resources.fluentcore.arm.implementation.AzureConfigurableImpl; @@ -124,6 +126,7 @@ public final class Azure { private final MSIManager msiManager; private final MonitorManager monitorManager; // private final EventHubManager eventHubManager; + private final AppPlatformManager appPlatformManager; private final String subscriptionId; private final Authenticated authenticated; private final SdkContext sdkContext; @@ -367,6 +370,7 @@ private Azure(HttpPipeline httpPipeline, AzureProfile profile, Authenticated aut this.msiManager = MSIManager.authenticate(httpPipeline, profile, sdkContext); this.monitorManager = MonitorManager.authenticate(httpPipeline, profile, sdkContext); // this.eventHubManager = EventHubManager.authenticate(restClient, subscriptionId, sdkContext); + this.appPlatformManager = AppPlatformManager.authenticate(httpPipeline, profile, sdkContext); this.subscriptionId = profile.subscriptionId(); this.authenticated = authenticated; } @@ -807,4 +811,9 @@ public BlobServices storageBlobServices() { public ManagementPolicies storageManagementPolicies() { return this.storageManager.managementPolicies(); } + + /** @return the spring service management API entry point */ + public SpringServices springServices() { + return this.appPlatformManager.springServices(); + } } diff --git a/sdk/management/docs/AUTH.md b/sdk/management/docs/AUTH.md index eaea25c97a46..6207ef90c2ba 100644 --- a/sdk/management/docs/AUTH.md +++ b/sdk/management/docs/AUTH.md @@ -61,13 +61,13 @@ AzureProfile profile = new AzureProfile("", " Reactor](#rxjava-to-reactor) +* [Additional Samples](#additional-samples) + +## Prerequisites + +Java Development Kit (JDK) with version 8 or above. + +## Updated Maven dependencies + +The latest dependencies for resource management libraries are [available here](https://azure.github.io/azure-sdk/releases/latest/all/java.html). Please look for packages that contains "azure-resourcemanager" in the namespace. + +## General Changes + +The latest Azure Java SDK for management libraries is a result of our efforts to create a resource management client library that is user-friendly and idiomatic to the Java ecosystem. + +Apart from redesigns resulting from the [new Azure SDK Design Guidelines for Java](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/management/docs/DESIGN.md), the latest version improves on several areas from old version. + +While conforming to the new guideline, we have tried our best to minimize the breaking changes. Most of the interfaces / classes / methods have stayed the same to offer user an easier migration experience. + +The important breaking changes are listed in the following sections: + +### Authentication + +In old version (`com.microsoft.azure.management.**`), ApplicationTokenCredentials is created with all the credential parameters. + +In new version (`com.azure.resourcemanager.**`), in order to provide an unified authentication based on Azure Identity for all Azure Java SDKs, the authentication mechanism has been re-designed and improved to offer a simpler interface. + +To the show the code snippets for the change: + +**In old version (`com.microsoft.azure.management.**`)** + +```java +ApplicationTokenCredential = new ApplicationTokenCredentials("", "", "", AzureEnvironment.AZURE) + .withDefaultSubscriptionId(""); +``` + +**Equivalent in new version (`com.azure.resourcemanager.**`)** + +```java +TokenCredential credential = new ClientSecretCredentialBuilder() + .clientId("") + .clientSecret("") + .tenantId("") + .build(); +AzureProfile profile = new AzureProfile("", "", AzureEnvironment.AZURE); +``` + +In addition to this change, the **support for using auth file has been removed**. In old version, the user can choose to authenticate via the auth file, like this: + +**In old version (`com.microsoft.azure.management.**`)** + +```java +Azure azure = Azure.authenticate(new File("my.azureauth")).withDefaultSubscription(); +``` +**In new version, this feature has been removed.** If this creates concern on your side, please file an issue to let us know. + +For detailed information on the benefits of using the new authentication classes, please refer to [this page](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/management/docs/AUTH.md) + +## Customized Policy + +Because of adopting Azure Core which is a shared library across all Azure SDKs, there is also a minor change regarding how customized policy in configured. + +In old version (`com.microsoft.azure.management.**`), we use `withInterceptor` and pass the customized interceptor class to the Azure object + +In new version (`com.azure.resourcemanager.**`), we use `WithPolicy` instead and pass the customized policy to the Azure object. It's also worth mentioning that the implementation of `HttpPipelinePolicy` is different from that of `Interceptor` from okhttp. + +So: + +**In old version (`com.microsoft.azure.management.**`)** + +```java +Azure azure = Azure.configure() + .withInterceptor(new CustomizedInterceptor()) + .authenticate(credential) + .withDefaultSubscription(); +``` + +**Equivalent in new version (`com.azure.resourcemanager.**`)** + +```java +Azure azure = Azure.configure() + .withPolicy(new CustomizedPolicy()) + .authenticate(credential, profile) + .withDefaultSubscription(); +``` + +## Custom HTTP Client + +Similar to the customized policy, there are changes regarding how the custom HTTP client is configured as well. The re-designed HTTP client builder in the new version is more flexible and the user can choose their own implementation of HTTP client and plug in what they need into the configuration. + +**In old version (`com.microsoft.azure.management.**`)** + +```java +OkHttpClient.Builder builder = new OkHttpClient.Builder().proxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 8888))); +RestClient client = new RestClient.Builder(builder, new Retrofit.Builder()) + .withCredentials(credential) + .build(); + +Azure azure = Azure.authenticate(client, "") + .withDefaultSubscription(); +``` + +**Equivalent in new version (`com.azure.resourcemanager.**`)** + +```java +HttpClient client = new OkHttpAsyncHttpClientBuilder() + .proxy(new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("127.0.0.1", 8888))) + .build(); + +Azure azure = Azure.configure() + .withHttpClient(client) + .authenticate(credential, profile) + .withDefaultSubscription(); +``` + +## Error Handling + +There is a minor namespace change in the exception class. To be specific, the previous `CloudException` has been re-named to `ManagementException`. + +**In old version (`com.microsoft.azure.management.**`)** + +```java +final String resourceGroupName = "invalid resource group name"; +try { + azure.resourceGroups().define(resourceGroupName) + .withRegion(Region.US_WEST2) + .create(); +} catch (CloudException e) { + System.err.printf("Response code: %s%n", e.body().code()); + System.err.printf("Response message: %s%n", e.body().message()); +} +``` + +**Equivalent in new version (`com.azure.resourcemanager.**`)** + +```java +final String resourceGroupName = "invalid resource group name"; +try { + azure.resourceGroups().define(resourceGroupName) + .withRegion(Region.US_WEST2) + .create(); +} catch (ManagementException e) { + System.err.printf("Response code: %s%n", e.getValue().getCode()); + System.err.printf("Response message: %s%n", e.getValue().getMessage()); +} +``` + +## rxJava to Reactor + +In old version (`com.microsoft.azure.management.**`), `rxJava` is used for non-blocking applications + +In new version (`com.azure.resourcemanager.**`), we have adopted `Reactor` as the main library in replacement of `rxJava` due to the Azure Core adoption. + +**In old version (`com.microsoft.azure.management.**`)** + +```java +azure.publicIPAddresses() + .define(publicIpName) + .withRegion(region) + .withExistingResourceGroup(rgName) + .withLeafDomainLabel(publicIpName) + .createAsync().flatMap(new Func1 < Indexable, Observable < Indexable >> () { + @Override + public Observable < Indexable > call(Indexable indexable) { + if (indexable instanceof PublicIPAddress) { + PublicIPAddress publicIp = (PublicIPAddress) indexable; + //============================================================= + // Create an Internet facing load balancer with + // One frontend IP address + // Two backend address pools which contain network interfaces for the virtual + // machines to receive HTTP and HTTPS network traffic from the load balancer + // Two load balancing rules for HTTP and HTTPS to map public ports on the load + // balancer to ports in the backend address pool + // Two probes which contain HTTP and HTTPS health probes used to check availability + // of virtual machines in the backend address pool + // Three inbound NAT rules which contain rules that map a public port on the load + // balancer to a port for a specific virtual machine in the backend address pool + // - this provides direct VM connectivity for SSH to port 22 and TELNET to port 23 + + return Observable.merge( + Observable.just(indexable), azure.loadBalancers().define(loadBalancerName1).withRegion(region).withExistingResourceGroup(rgName) + // Add two rules that uses above backend and probe + .defineLoadBalancingRule(httpLoadBalancingRule).withProtocol(TransportProtocol.TCP).fromFrontend(frontendName).fromFrontendPort(80).toBackend(backendPoolName1).withProbe(httpProbe).attach().defineLoadBalancingRule(httpsLoadBalancingRule).withProtocol(TransportProtocol.TCP).fromFrontend(frontendName).fromFrontendPort(443).toBackend(backendPoolName2).withProbe(httpsProbe).attach() + // Add nat pools to enable direct VM connectivity for + // SSH to port 22 and TELNET to port 23 + + .defineInboundNatPool(natPool50XXto22).withProtocol(TransportProtocol.TCP).fromFrontend(frontendName).fromFrontendPortRange(5000, 5099).toBackendPort(22).attach().defineInboundNatPool(natPool60XXto23).withProtocol(TransportProtocol.TCP).fromFrontend(frontendName).fromFrontendPortRange(6000, 6099).toBackendPort(23).attach() + + // Explicitly define the frontend + .definePublicFrontend(frontendName).withExistingPublicIPAddress(publicIp).attach + + // Add two probes one per rule + .defineHttpProbe(httpProbe).withRequestPath("/").withPort(80).attach().defineHttpProbe(httpsProbe).withRequestPath("/").withPort(443).attach() + .createAsync()); + } + return Observable.just(indexable); + } + })).toBlocking().subscribe(new Action1 < Indexable > () { + @Override + public void call(Indexable indexable) { + createdResources.add(indexable); + } +}); +``` + +[**Link to full sample**](https://github.com/Azure/azure-libraries-for-java/blob/master/azure-samples/src/main/java/com/microsoft/azure/management/compute/samples/ManageVirtualMachineScaleSetAsync.java#L100) + + +**Equivalent in new version (`com.azure.resourcemanager.**`)** + +```java +final List < Indexable > createdResources = new ArrayList < > (); +azure.resourceGroups().define(rgName).withRegion(region).create(); +Flux.merge( + azure.networks() + .define(vnetName) + .withRegion(region) + .withExistingResourceGroup(rgName) + .withAddressSpace("172.16.0.0/16") + .defineSubnet("Front-end") + .withAddressPrefix("172.16.1.0/24") + .attach() + .createAsync(), + azure.publicIpAddresses() + .define(publicIpName) + .withRegion(region) + .withExistingResourceGroup(rgName) + .withLeafDomainLabel(publicIpName) + .createAsync().flatMap(indexable - > { + if (indexable instanceof PublicIpAddress) { + PublicIpAddress publicIp = (PublicIpAddress) indexable; + //============================================================= + // Create an Internet facing load balancer with + // One frontend IP address + // Two backend address pools which contain network interfaces for the virtual + // machines to receive HTTP and HTTPS network traffic from the load balancer + // Two load balancing rules for HTTP and HTTPS to map public ports on the load + // balancer to ports in the backend address pool + // Two probes which contain HTTP and HTTPS health probes used to check availability + // of virtual machines in the backend address pool + // Three inbound NAT rules which contain rules that map a public port on the load + // balancer to a port for a specific virtual machine in the backend address pool + // - this provides direct VM connectivity for SSH to port 22 and TELNET to port 23 + + return Flux.merge( + Flux.just(indexable), azure.loadBalancers().define(loadBalancerName1).withRegion(region).withExistingResourceGroup(rgName) + // Add two rules that uses above backend and probe + .defineLoadBalancingRule(httpLoadBalancingRule).withProtocol(TransportProtocol.TCP).fromFrontend(frontendName).fromFrontendPort(80).toBackend(backendPoolName1).withProbe(httpProbe).attach().defineLoadBalancingRule(httpsLoadBalancingRule).withProtocol(TransportProtocol.TCP).fromFrontend(frontendName).fromFrontendPort(443).toBackend(backendPoolName2).withProbe(httpsProbe).attach() + // Add nat pools to enable direct VM connectivity for + // SSH to port 22 and TELNET to port 23 + .defineInboundNatPool(natPool50XXto22).withProtocol(TransportProtocol.TCP).fromFrontend(frontendName).fromFrontendPortRange(5000, 5099).toBackendPort(22).attach().defineInboundNatPool(natPool60XXto23).withProtocol(TransportProtocol.TCP).fromFrontend(frontendName).fromFrontendPortRange(6000, 6099).toBackendPort(23).attach() + + // Explicitly define the frontend + .definePublicFrontend(frontendName).withExistingPublicIpAddress(publicIp).attach() + + // Add two probes one per rule + .defineHttpProbe(httpProbe).withRequestPath("/").withPort(80).attach().defineHttpProbe(httpsProbe).withRequestPath("/").withPort(443).attach().createAsync()); + } + return Flux.just(indexable); + })).flatMap(indexable - > { + createdResources.add(indexable); + return Flux.just(indexable); +}).last().block(); +``` + +[**Link to full sample**](https://github.com/Azure/azure-sdk-for-java/blob/7beda69/sdk/management/samples/src/main/java/com/azure/resourcemanager/compute/samples/ManageVirtualMachineScaleSetAsync.java#L98) + +## Additional Samples + +More samples can be found at : +- [README for new version of SDK](http://aka.ms/azure-sdk-java-mgmt) +- [Code Samples for Resource Management Libraries](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/management/docs/SAMPLE.md) +- [Authentication Documentation](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/management/docs/AUTH.md) + +## Need help? + +If you have encountered an issue during migration, please file an issue via [Github Issues](https://github.com/Azure/azure-sdk-for-java/issues) and make sure you add the "Preview" label to the issue diff --git a/sdk/management/package.json b/sdk/management/package.json index ee1d9771e9ee..332c01ceeecf 100644 --- a/sdk/management/package.json +++ b/sdk/management/package.json @@ -33,7 +33,8 @@ "credcheck_storage": "node credcheck.js --path=../storage/mgmt/src/test/resources/session-records/", "credcheck_azure": "node credcheck.js --path=./azure/src/test/resources/session-records/", "credcheck_samples": "node credcheck.js --path=./samples/src/test/resources/session-records/", - "credcheck_all": "run-s credcheck_appservice credcheck_authorization credcheck_compute credcheck_containerregistry credcheck_containerservice credcheck_cosmos credcheck_dns credcheck_keyvault credcheck_msi credcheck_monitor credcheck_network credcheck_resources credcheck_sql credcheck_storage credcheck_azure credcheck_samples" + "credcheck_all": "run-s credcheck_appservice credcheck_authorization credcheck_compute credcheck_containerregistry credcheck_containerservice credcheck_cosmos credcheck_dns credcheck_keyvault credcheck_msi credcheck_monitor credcheck_network credcheck_resources credcheck_sql credcheck_storage credcheck_azure credcheck_samples", + "servcheck": "node servcheck.js" }, "devDependencies": { "colors": "1.1.2", @@ -45,6 +46,7 @@ "gulp-shell": "^0.8.0", "p-all": "^1.0.0", "yargs": "3.31.0", - "npm-run-all": "4.1.5" + "npm-run-all": "4.1.5", + "pom-parser": "1.2.0" } } diff --git a/sdk/management/pom.xml b/sdk/management/pom.xml index 676184d7d606..a290e23ca8e7 100644 --- a/sdk/management/pom.xml +++ b/sdk/management/pom.xml @@ -473,6 +473,7 @@ ./azure ../appservice/mgmt + ../appplatform/mgmt ../compute/mgmt ../dns/mgmt ../authorization/mgmt diff --git a/sdk/management/servcheck.js b/sdk/management/servcheck.js new file mode 100644 index 000000000000..0a2b8817eeba --- /dev/null +++ b/sdk/management/servcheck.js @@ -0,0 +1,108 @@ +const args = require('yargs').argv; +const os = require('os'); +const fs = require('fs'); +const path = require('path'); +const parser = require("pom-parser"); +const colors = require('colors'); + + +function servcheck() { + console.log('[INFO] starting to check api versions of services...\n'); + readPom(); +} + + +function readPom(callback) { + var opts = { + filePath: __dirname + "/pom.xml", + }; + parser.parse(opts, function(err, response) { + if (err) { + console.log('[ERROR] ' + err); + process.exit(1); + } + console.log('[INFO] reading modules from pom...'); + readProjSpecs(response.pomObject.project.modules.module); + }); +} + +const mappings = require('./api-specs.json'); + +function readProjSpecs(modules) { + console.log('[INFO] reading specs in project...'); + var map = {}; + Object.keys(mappings).forEach(key => { + if (modules.includes(mappings[key].dir)) { + var val = getCurrentApiVersion(mappings[key].args); + if (val !== undefined) { + map[key] = {}; + map[key].name = key; + map[key].tag = val; + map[key].source = mappings[key].source; + } + } + }); + readLatestSpecs(map); +} + +function getCurrentApiVersion(value) { + var res = undefined; + value.split(/\s+/).forEach(item => { + if (item.includes('--tag=')) { + res = item.replace('--tag=', ''); + } + }); + return res; +} + +function readLatestSpecs(map) { + console.log('[INFO] reading specs from swagger root...'); + Object.keys(map).forEach(item => { + readLatestApiVersion(map[item]); + }); +} + +const dir = args['spec-root']; + +function readLatestApiVersion(spec) { + console.log('\n[Service] ' + spec.name); + console.log(' current: ' + spec.tag); + const filePath = path.join(dir, spec.source); + const content = fs.readFileSync(filePath).toString('utf8'); + + var latest = {}; + var allTags = []; + var lines = content.split('\n'); + lines.forEach(line => { + if (line.startsWith('tag:')) { + if (latest.tag === undefined || latest.tag != undefined && line.includes(spec.name)) { + latest.tag = getApiVersion(line, 'tag:'); + } + } + if (line.includes('Tag:') && !line.includes(' and ')) { + allTags.push(getApiVersion(line, '### Tag:')); + } + }); + + console.log(' latest: ' + latest.tag); + + if (spec.tag !== latest.tag) { + allTags.sort().reverse(); + console.log('\n potential versions to upgrade:'); + allTags.forEach(tag => { + if (tag == spec.tag) { + console.log(' ' + tag.bold.underline.yellow); + } else { + console.log(' ' + tag); + } + }); + } + + return latest; +} + +function getApiVersion(value, target) { + return value.replace(target, '').replace('\r', '').trim(); +} + +servcheck(); \ No newline at end of file diff --git a/sdk/monitor/mgmt/src/main/java/com/azure/resourcemanager/monitor/MonitorClient.java b/sdk/monitor/mgmt/src/main/java/com/azure/resourcemanager/monitor/MonitorClient.java index f1181b9a9fed..209b257180c2 100644 --- a/sdk/monitor/mgmt/src/main/java/com/azure/resourcemanager/monitor/MonitorClient.java +++ b/sdk/monitor/mgmt/src/main/java/com/azure/resourcemanager/monitor/MonitorClient.java @@ -8,7 +8,7 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.management.AzureEnvironment; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.AzureServiceClient; +import com.azure.resourcemanager.resources.fluentcore.AzureServiceClient; import com.azure.resourcemanager.monitor.fluent.ActionGroupsClient; import com.azure.resourcemanager.monitor.fluent.ActivityLogAlertsClient; import com.azure.resourcemanager.monitor.fluent.ActivityLogsClient; diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/NetworkManagementClient.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/NetworkManagementClient.java index 0a9c2bb1bf02..3eeb315c3551 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/NetworkManagementClient.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/NetworkManagementClient.java @@ -33,7 +33,7 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; -import com.azure.resourcemanager.AzureServiceClient; +import com.azure.resourcemanager.resources.fluentcore.AzureServiceClient; import com.azure.resourcemanager.network.fluent.ApplicationGatewaysClient; import com.azure.resourcemanager.network.fluent.ApplicationSecurityGroupsClient; import com.azure.resourcemanager.network.fluent.AvailableDelegationsClient; diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/fluent/inner/UsageInner.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/fluent/inner/UsageInner.java index e7fbc65e2e65..76248a9aec8a 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/fluent/inner/UsageInner.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/fluent/inner/UsageInner.java @@ -7,6 +7,7 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.network.models.UsageName; +import com.azure.resourcemanager.network.models.UsageUnit; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; @@ -25,7 +26,7 @@ public final class UsageInner { * An enum describing the unit of measurement. */ @JsonProperty(value = "unit", required = true) - private String unit; + private UsageUnit unit; /* * The current value of the usage. @@ -45,11 +46,6 @@ public final class UsageInner { @JsonProperty(value = "name", required = true) private UsageName name; - /** Creates an instance of UsageInner class. */ - public UsageInner() { - unit = "Count"; - } - /** * Get the id property: Resource identifier. * @@ -64,7 +60,7 @@ public String id() { * * @return the unit value. */ - public String unit() { + public UsageUnit unit() { return this.unit; } @@ -74,7 +70,7 @@ public String unit() { * @param unit the unit value to set. * @return the UsageInner object itself. */ - public UsageInner withUnit(String unit) { + public UsageInner withUnit(UsageUnit unit) { this.unit = unit; return this; } @@ -145,6 +141,11 @@ public UsageInner withName(UsageName name) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (unit() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property unit in model UsageInner")); + } if (name() == null) { throw logger .logExceptionAsError( diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/implementation/NetworkUsageImpl.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/implementation/NetworkUsageImpl.java index 8f3453b0cb70..ee78b0daa521 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/implementation/NetworkUsageImpl.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/implementation/NetworkUsageImpl.java @@ -3,9 +3,9 @@ package com.azure.resourcemanager.network.implementation; import com.azure.resourcemanager.network.models.NetworkUsage; -import com.azure.resourcemanager.network.models.NetworkUsageUnit; import com.azure.resourcemanager.network.models.UsageName; import com.azure.resourcemanager.network.fluent.inner.UsageInner; +import com.azure.resourcemanager.network.models.UsageUnit; import com.azure.resourcemanager.resources.fluentcore.model.implementation.WrapperImpl; import com.azure.resourcemanager.resources.fluentcore.utils.Utils; @@ -16,8 +16,8 @@ class NetworkUsageImpl extends WrapperImpl implements NetworkUsage { } @Override - public NetworkUsageUnit unit() { - return NetworkUsageUnit.fromString(inner().unit()); + public UsageUnit unit() { + return inner().unit(); } @Override diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/AzureFirewallSkuTier.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/AzureFirewallSkuTier.java index acdf01492007..9016a806853e 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/AzureFirewallSkuTier.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/AzureFirewallSkuTier.java @@ -4,41 +4,28 @@ package com.azure.resourcemanager.network.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for AzureFirewallSkuTier. */ -public enum AzureFirewallSkuTier { - /** Enum value Standard. */ - STANDARD("Standard"); - - /** The actual serialized value for a AzureFirewallSkuTier instance. */ - private final String value; - - AzureFirewallSkuTier(String value) { - this.value = value; - } +public final class AzureFirewallSkuTier extends ExpandableStringEnum { + /** Static value Standard for AzureFirewallSkuTier. */ + public static final AzureFirewallSkuTier STANDARD = fromString("Standard"); /** - * Parses a serialized value to a AzureFirewallSkuTier instance. + * Creates or finds a AzureFirewallSkuTier from its string representation. * - * @param value the serialized value to parse. - * @return the parsed AzureFirewallSkuTier object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding AzureFirewallSkuTier. */ @JsonCreator - public static AzureFirewallSkuTier fromString(String value) { - AzureFirewallSkuTier[] items = AzureFirewallSkuTier.values(); - for (AzureFirewallSkuTier item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static AzureFirewallSkuTier fromString(String name) { + return fromString(name, AzureFirewallSkuTier.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** @return known AzureFirewallSkuTier values. */ + public static Collection values() { + return values(AzureFirewallSkuTier.class); } } diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/ConnectionMonitorEndpointFilterItemType.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/ConnectionMonitorEndpointFilterItemType.java index a9c94ccf9544..e9c06f94fe09 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/ConnectionMonitorEndpointFilterItemType.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/ConnectionMonitorEndpointFilterItemType.java @@ -4,41 +4,29 @@ package com.azure.resourcemanager.network.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for ConnectionMonitorEndpointFilterItemType. */ -public enum ConnectionMonitorEndpointFilterItemType { - /** Enum value AgentAddress. */ - AGENT_ADDRESS("AgentAddress"); - - /** The actual serialized value for a ConnectionMonitorEndpointFilterItemType instance. */ - private final String value; - - ConnectionMonitorEndpointFilterItemType(String value) { - this.value = value; - } +public final class ConnectionMonitorEndpointFilterItemType + extends ExpandableStringEnum { + /** Static value AgentAddress for ConnectionMonitorEndpointFilterItemType. */ + public static final ConnectionMonitorEndpointFilterItemType AGENT_ADDRESS = fromString("AgentAddress"); /** - * Parses a serialized value to a ConnectionMonitorEndpointFilterItemType instance. + * Creates or finds a ConnectionMonitorEndpointFilterItemType from its string representation. * - * @param value the serialized value to parse. - * @return the parsed ConnectionMonitorEndpointFilterItemType object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding ConnectionMonitorEndpointFilterItemType. */ @JsonCreator - public static ConnectionMonitorEndpointFilterItemType fromString(String value) { - ConnectionMonitorEndpointFilterItemType[] items = ConnectionMonitorEndpointFilterItemType.values(); - for (ConnectionMonitorEndpointFilterItemType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static ConnectionMonitorEndpointFilterItemType fromString(String name) { + return fromString(name, ConnectionMonitorEndpointFilterItemType.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** @return known ConnectionMonitorEndpointFilterItemType values. */ + public static Collection values() { + return values(ConnectionMonitorEndpointFilterItemType.class); } } diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/ConnectionMonitorEndpointFilterType.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/ConnectionMonitorEndpointFilterType.java index 2e9617748f80..2dab2c699f32 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/ConnectionMonitorEndpointFilterType.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/ConnectionMonitorEndpointFilterType.java @@ -4,41 +4,29 @@ package com.azure.resourcemanager.network.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for ConnectionMonitorEndpointFilterType. */ -public enum ConnectionMonitorEndpointFilterType { - /** Enum value Include. */ - INCLUDE("Include"); - - /** The actual serialized value for a ConnectionMonitorEndpointFilterType instance. */ - private final String value; - - ConnectionMonitorEndpointFilterType(String value) { - this.value = value; - } +public final class ConnectionMonitorEndpointFilterType + extends ExpandableStringEnum { + /** Static value Include for ConnectionMonitorEndpointFilterType. */ + public static final ConnectionMonitorEndpointFilterType INCLUDE = fromString("Include"); /** - * Parses a serialized value to a ConnectionMonitorEndpointFilterType instance. + * Creates or finds a ConnectionMonitorEndpointFilterType from its string representation. * - * @param value the serialized value to parse. - * @return the parsed ConnectionMonitorEndpointFilterType object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding ConnectionMonitorEndpointFilterType. */ @JsonCreator - public static ConnectionMonitorEndpointFilterType fromString(String value) { - ConnectionMonitorEndpointFilterType[] items = ConnectionMonitorEndpointFilterType.values(); - for (ConnectionMonitorEndpointFilterType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static ConnectionMonitorEndpointFilterType fromString(String name) { + return fromString(name, ConnectionMonitorEndpointFilterType.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** @return known ConnectionMonitorEndpointFilterType values. */ + public static Collection values() { + return values(ConnectionMonitorEndpointFilterType.class); } } diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/FirewallPolicyNatRuleActionType.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/FirewallPolicyNatRuleActionType.java index 8018b04cb320..f1b91badf6f8 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/FirewallPolicyNatRuleActionType.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/FirewallPolicyNatRuleActionType.java @@ -4,41 +4,28 @@ package com.azure.resourcemanager.network.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for FirewallPolicyNatRuleActionType. */ -public enum FirewallPolicyNatRuleActionType { - /** Enum value DNAT. */ - DNAT("DNAT"); - - /** The actual serialized value for a FirewallPolicyNatRuleActionType instance. */ - private final String value; - - FirewallPolicyNatRuleActionType(String value) { - this.value = value; - } +public final class FirewallPolicyNatRuleActionType extends ExpandableStringEnum { + /** Static value DNAT for FirewallPolicyNatRuleActionType. */ + public static final FirewallPolicyNatRuleActionType DNAT = fromString("DNAT"); /** - * Parses a serialized value to a FirewallPolicyNatRuleActionType instance. + * Creates or finds a FirewallPolicyNatRuleActionType from its string representation. * - * @param value the serialized value to parse. - * @return the parsed FirewallPolicyNatRuleActionType object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding FirewallPolicyNatRuleActionType. */ @JsonCreator - public static FirewallPolicyNatRuleActionType fromString(String value) { - FirewallPolicyNatRuleActionType[] items = FirewallPolicyNatRuleActionType.values(); - for (FirewallPolicyNatRuleActionType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static FirewallPolicyNatRuleActionType fromString(String name) { + return fromString(name, FirewallPolicyNatRuleActionType.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** @return known FirewallPolicyNatRuleActionType values. */ + public static Collection values() { + return values(FirewallPolicyNatRuleActionType.class); } } diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/FlowLogFormatType.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/FlowLogFormatType.java index 5778e94282a4..fddce7ca6e0d 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/FlowLogFormatType.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/FlowLogFormatType.java @@ -4,41 +4,28 @@ package com.azure.resourcemanager.network.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for FlowLogFormatType. */ -public enum FlowLogFormatType { - /** Enum value JSON. */ - JSON("JSON"); - - /** The actual serialized value for a FlowLogFormatType instance. */ - private final String value; - - FlowLogFormatType(String value) { - this.value = value; - } +public final class FlowLogFormatType extends ExpandableStringEnum { + /** Static value JSON for FlowLogFormatType. */ + public static final FlowLogFormatType JSON = fromString("JSON"); /** - * Parses a serialized value to a FlowLogFormatType instance. + * Creates or finds a FlowLogFormatType from its string representation. * - * @param value the serialized value to parse. - * @return the parsed FlowLogFormatType object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding FlowLogFormatType. */ @JsonCreator - public static FlowLogFormatType fromString(String value) { - FlowLogFormatType[] items = FlowLogFormatType.values(); - for (FlowLogFormatType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static FlowLogFormatType fromString(String name) { + return fromString(name, FlowLogFormatType.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** @return known FlowLogFormatType values. */ + public static Collection values() { + return values(FlowLogFormatType.class); } } diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/HttpMethod.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/HttpMethod.java index 6a58b5246151..c4b10a52e74d 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/HttpMethod.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/HttpMethod.java @@ -4,41 +4,28 @@ package com.azure.resourcemanager.network.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for HttpMethod. */ -public enum HttpMethod { - /** Enum value Get. */ - GET("Get"); - - /** The actual serialized value for a HttpMethod instance. */ - private final String value; - - HttpMethod(String value) { - this.value = value; - } +public final class HttpMethod extends ExpandableStringEnum { + /** Static value Get for HttpMethod. */ + public static final HttpMethod GET = fromString("Get"); /** - * Parses a serialized value to a HttpMethod instance. + * Creates or finds a HttpMethod from its string representation. * - * @param value the serialized value to parse. - * @return the parsed HttpMethod object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding HttpMethod. */ @JsonCreator - public static HttpMethod fromString(String value) { - HttpMethod[] items = HttpMethod.values(); - for (HttpMethod item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static HttpMethod fromString(String name) { + return fromString(name, HttpMethod.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** @return known HttpMethod values. */ + public static Collection values() { + return values(HttpMethod.class); } } diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/ManagedRuleEnabledState.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/ManagedRuleEnabledState.java index 2ced6dfc1125..f2ff5af16ad2 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/ManagedRuleEnabledState.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/ManagedRuleEnabledState.java @@ -4,41 +4,28 @@ package com.azure.resourcemanager.network.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for ManagedRuleEnabledState. */ -public enum ManagedRuleEnabledState { - /** Enum value Disabled. */ - DISABLED("Disabled"); - - /** The actual serialized value for a ManagedRuleEnabledState instance. */ - private final String value; - - ManagedRuleEnabledState(String value) { - this.value = value; - } +public final class ManagedRuleEnabledState extends ExpandableStringEnum { + /** Static value Disabled for ManagedRuleEnabledState. */ + public static final ManagedRuleEnabledState DISABLED = fromString("Disabled"); /** - * Parses a serialized value to a ManagedRuleEnabledState instance. + * Creates or finds a ManagedRuleEnabledState from its string representation. * - * @param value the serialized value to parse. - * @return the parsed ManagedRuleEnabledState object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding ManagedRuleEnabledState. */ @JsonCreator - public static ManagedRuleEnabledState fromString(String value) { - ManagedRuleEnabledState[] items = ManagedRuleEnabledState.values(); - for (ManagedRuleEnabledState item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static ManagedRuleEnabledState fromString(String name) { + return fromString(name, ManagedRuleEnabledState.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** @return known ManagedRuleEnabledState values. */ + public static Collection values() { + return values(ManagedRuleEnabledState.class); } } diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/NatGatewaySkuName.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/NatGatewaySkuName.java index 787d6a4fbe5b..e9ab2796310e 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/NatGatewaySkuName.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/NatGatewaySkuName.java @@ -4,41 +4,28 @@ package com.azure.resourcemanager.network.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for NatGatewaySkuName. */ -public enum NatGatewaySkuName { - /** Enum value Standard. */ - STANDARD("Standard"); - - /** The actual serialized value for a NatGatewaySkuName instance. */ - private final String value; - - NatGatewaySkuName(String value) { - this.value = value; - } +public final class NatGatewaySkuName extends ExpandableStringEnum { + /** Static value Standard for NatGatewaySkuName. */ + public static final NatGatewaySkuName STANDARD = fromString("Standard"); /** - * Parses a serialized value to a NatGatewaySkuName instance. + * Creates or finds a NatGatewaySkuName from its string representation. * - * @param value the serialized value to parse. - * @return the parsed NatGatewaySkuName object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding NatGatewaySkuName. */ @JsonCreator - public static NatGatewaySkuName fromString(String value) { - NatGatewaySkuName[] items = NatGatewaySkuName.values(); - for (NatGatewaySkuName item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static NatGatewaySkuName fromString(String name) { + return fromString(name, NatGatewaySkuName.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** @return known NatGatewaySkuName values. */ + public static Collection values() { + return values(NatGatewaySkuName.class); } } diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/NetworkUsage.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/NetworkUsage.java index d2ea5f31913b..20d6e6767ad9 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/NetworkUsage.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/NetworkUsage.java @@ -10,7 +10,7 @@ @Fluent public interface NetworkUsage extends HasInner { /** @return the unit of measurement. */ - NetworkUsageUnit unit(); + UsageUnit unit(); /** @return the current count of the allocated resources in the subscription */ long currentValue(); diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/NetworkUsageUnit.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/NetworkUsageUnit.java deleted file mode 100644 index 6b05dd248ea9..000000000000 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/NetworkUsageUnit.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.resourcemanager.network.models; - -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** Network usage units. */ -public class NetworkUsageUnit extends ExpandableStringEnum { - /** Static value Count for NetworkUsageUnit. */ - public static final NetworkUsageUnit COUNT = fromString("Count"); - - /** Static value Bytes for NetworkUsageUnit. */ - public static final NetworkUsageUnit BYTES = fromString("Bytes"); - - /** Static value Seconds for NetworkUsageUnit. */ - public static final NetworkUsageUnit SECONDS = fromString("Seconds"); - - /** Static value Percent for NetworkUsageUnit. */ - public static final NetworkUsageUnit PERCENT = fromString("Percent"); - - /** Static value CountsPerSecond for NetworkUsageUnit. */ - public static final NetworkUsageUnit COUNTS_PER_SECOND = fromString("CountsPerSecond"); - - /** Static value BytesPerSecond for ComputeUsageUnit. */ - public static final NetworkUsageUnit BYTES_PER_SECOND = fromString("BytesPerSecond"); - - /** - * Finds or creates a network usage unit based on the specified name. - * - * @param name a name - * @return an instance of NetworkUsageUnit - */ - public static NetworkUsageUnit fromString(String name) { - return fromString(name, NetworkUsageUnit.class); - } - - /** @return known network usage units */ - public static Collection values() { - return values(NetworkUsageUnit.class); - } -} diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/OutputType.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/OutputType.java index 0b807f0e29a6..4c7c992b911c 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/OutputType.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/OutputType.java @@ -4,41 +4,28 @@ package com.azure.resourcemanager.network.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for OutputType. */ -public enum OutputType { - /** Enum value Workspace. */ - WORKSPACE("Workspace"); - - /** The actual serialized value for a OutputType instance. */ - private final String value; - - OutputType(String value) { - this.value = value; - } +public final class OutputType extends ExpandableStringEnum { + /** Static value Workspace for OutputType. */ + public static final OutputType WORKSPACE = fromString("Workspace"); /** - * Parses a serialized value to a OutputType instance. + * Creates or finds a OutputType from its string representation. * - * @param value the serialized value to parse. - * @return the parsed OutputType object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding OutputType. */ @JsonCreator - public static OutputType fromString(String value) { - OutputType[] items = OutputType.values(); - for (OutputType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static OutputType fromString(String name) { + return fromString(name, OutputType.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** @return known OutputType values. */ + public static Collection values() { + return values(OutputType.class); } } diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/PublicIpPrefixSkuName.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/PublicIpPrefixSkuName.java index 3195f9541be9..3607cb9e7d74 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/PublicIpPrefixSkuName.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/PublicIpPrefixSkuName.java @@ -4,41 +4,28 @@ package com.azure.resourcemanager.network.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for PublicIpPrefixSkuName. */ -public enum PublicIpPrefixSkuName { - /** Enum value Standard. */ - STANDARD("Standard"); - - /** The actual serialized value for a PublicIpPrefixSkuName instance. */ - private final String value; - - PublicIpPrefixSkuName(String value) { - this.value = value; - } +public final class PublicIpPrefixSkuName extends ExpandableStringEnum { + /** Static value Standard for PublicIpPrefixSkuName. */ + public static final PublicIpPrefixSkuName STANDARD = fromString("Standard"); /** - * Parses a serialized value to a PublicIpPrefixSkuName instance. + * Creates or finds a PublicIpPrefixSkuName from its string representation. * - * @param value the serialized value to parse. - * @return the parsed PublicIpPrefixSkuName object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding PublicIpPrefixSkuName. */ @JsonCreator - public static PublicIpPrefixSkuName fromString(String value) { - PublicIpPrefixSkuName[] items = PublicIpPrefixSkuName.values(); - for (PublicIpPrefixSkuName item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static PublicIpPrefixSkuName fromString(String name) { + return fromString(name, PublicIpPrefixSkuName.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** @return known PublicIpPrefixSkuName values. */ + public static Collection values() { + return values(PublicIpPrefixSkuName.class); } } diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/RouteFilterRuleType.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/RouteFilterRuleType.java index 49de03d20274..6b9a5c0f7e96 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/RouteFilterRuleType.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/RouteFilterRuleType.java @@ -4,41 +4,28 @@ package com.azure.resourcemanager.network.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for RouteFilterRuleType. */ -public enum RouteFilterRuleType { - /** Enum value Community. */ - COMMUNITY("Community"); - - /** The actual serialized value for a RouteFilterRuleType instance. */ - private final String value; - - RouteFilterRuleType(String value) { - this.value = value; - } +public final class RouteFilterRuleType extends ExpandableStringEnum { + /** Static value Community for RouteFilterRuleType. */ + public static final RouteFilterRuleType COMMUNITY = fromString("Community"); /** - * Parses a serialized value to a RouteFilterRuleType instance. + * Creates or finds a RouteFilterRuleType from its string representation. * - * @param value the serialized value to parse. - * @return the parsed RouteFilterRuleType object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding RouteFilterRuleType. */ @JsonCreator - public static RouteFilterRuleType fromString(String value) { - RouteFilterRuleType[] items = RouteFilterRuleType.values(); - for (RouteFilterRuleType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static RouteFilterRuleType fromString(String name) { + return fromString(name, RouteFilterRuleType.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** @return known RouteFilterRuleType values. */ + public static Collection values() { + return values(RouteFilterRuleType.class); } } diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/UsageUnit.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/UsageUnit.java new file mode 100644 index 000000000000..66d59e6a65d5 --- /dev/null +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/UsageUnit.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.network.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for UsageUnit. */ +public final class UsageUnit extends ExpandableStringEnum { + /** Static value Count for UsageUnit. */ + public static final UsageUnit COUNT = fromString("Count"); + + /** + * Creates or finds a UsageUnit from its string representation. + * + * @param name a name to look for. + * @return the corresponding UsageUnit. + */ + @JsonCreator + public static UsageUnit fromString(String name) { + return fromString(name, UsageUnit.class); + } + + /** @return known UsageUnit values. */ + public static Collection values() { + return values(UsageUnit.class); + } +} diff --git a/sdk/parents/azure-arm-parent/CHANGELOG.md b/sdk/parents/azure-arm-parent/CHANGELOG.md new file mode 100644 index 000000000000..c51d4b22dcf4 --- /dev/null +++ b/sdk/parents/azure-arm-parent/CHANGELOG.md @@ -0,0 +1,3 @@ +# Release History + +## 1.3.2 (Unreleased) \ No newline at end of file diff --git a/sdk/parents/azure-client-sdk-parent/CHANGELOG.md b/sdk/parents/azure-client-sdk-parent/CHANGELOG.md new file mode 100644 index 000000000000..a48fd29ad0e5 --- /dev/null +++ b/sdk/parents/azure-client-sdk-parent/CHANGELOG.md @@ -0,0 +1,3 @@ +# Release History + +## 1.7.0 (Unreleased) \ No newline at end of file diff --git a/sdk/parents/azure-data-sdk-parent/CHANGELOG.md b/sdk/parents/azure-data-sdk-parent/CHANGELOG.md new file mode 100644 index 000000000000..436d86f052f3 --- /dev/null +++ b/sdk/parents/azure-data-sdk-parent/CHANGELOG.md @@ -0,0 +1,3 @@ +# Release History + +## 1.3.0 (Unreleased) \ No newline at end of file diff --git a/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/package-info.java b/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/package-info.java deleted file mode 100644 index 5e7574c51433..000000000000 --- a/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. - -/** - * This package contains the base classes for management sdk. - */ -package com.azure.resourcemanager; diff --git a/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/FeatureClient.java b/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/FeatureClient.java index ee1313e56046..d428e7230430 100644 --- a/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/FeatureClient.java +++ b/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/FeatureClient.java @@ -28,7 +28,7 @@ import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.AzureServiceClient; +import com.azure.resourcemanager.resources.fluentcore.AzureServiceClient; import com.azure.resourcemanager.resources.fluent.FeaturesClient; import com.azure.resourcemanager.resources.fluent.inner.OperationInner; import com.azure.resourcemanager.resources.fluent.inner.OperationListResultInner; diff --git a/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/PolicyClient.java b/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/PolicyClient.java index eea782a9840a..a4f8ceb91829 100644 --- a/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/PolicyClient.java +++ b/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/PolicyClient.java @@ -8,7 +8,7 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.management.AzureEnvironment; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.AzureServiceClient; +import com.azure.resourcemanager.resources.fluentcore.AzureServiceClient; import com.azure.resourcemanager.resources.fluent.PolicyAssignmentsClient; import com.azure.resourcemanager.resources.fluent.PolicyDefinitionsClient; import com.azure.resourcemanager.resources.fluent.PolicySetDefinitionsClient; diff --git a/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/ResourceManagementClient.java b/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/ResourceManagementClient.java index e1258f9b928d..09f0cc3d76b5 100644 --- a/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/ResourceManagementClient.java +++ b/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/ResourceManagementClient.java @@ -8,7 +8,7 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.management.AzureEnvironment; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.AzureServiceClient; +import com.azure.resourcemanager.resources.fluentcore.AzureServiceClient; import com.azure.resourcemanager.resources.fluent.DeploymentOperationsClient; import com.azure.resourcemanager.resources.fluent.DeploymentsClient; import com.azure.resourcemanager.resources.fluent.OperationsClient; diff --git a/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/SubscriptionClient.java b/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/SubscriptionClient.java index b790dbe35365..41589bc4bd2c 100644 --- a/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/SubscriptionClient.java +++ b/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/SubscriptionClient.java @@ -8,7 +8,7 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.management.AzureEnvironment; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.AzureServiceClient; +import com.azure.resourcemanager.resources.fluentcore.AzureServiceClient; import com.azure.resourcemanager.resources.fluent.SubscriptionsClient; import com.azure.resourcemanager.resources.fluent.TenantsClient; diff --git a/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/AzureServiceClient.java b/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/fluentcore/AzureServiceClient.java similarity index 79% rename from sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/AzureServiceClient.java rename to sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/fluentcore/AzureServiceClient.java index db8fe10693d9..9ec1a0f8ac03 100644 --- a/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/AzureServiceClient.java +++ b/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/fluentcore/AzureServiceClient.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.resourcemanager; +package com.azure.resourcemanager.resources.fluentcore; import com.azure.core.http.HttpPipeline; import com.azure.core.http.rest.Response; @@ -28,20 +28,15 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import javax.xml.bind.annotation.adapters.HexBinaryAdapter; import java.io.IOException; import java.lang.reflect.Type; -import java.net.NetworkInterface; import java.nio.ByteBuffer; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; import java.time.LocalDateTime; import java.time.OffsetDateTime; import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalQueries; -import java.util.Enumeration; /** * ServiceClient is the abstraction for accessing REST operations and their payload data types. @@ -54,20 +49,6 @@ protected AzureServiceClient(HttpPipeline httpPipeline, AzureEnvironment environ ((AzureJacksonAdapter) serializerAdapter).serializer().registerModule(DateTimeDeserializer.getModule()); } - /** - * The default User-Agent header. Override this method to override the user agent. - * - * @return the user agent string. - */ - public String userAgent() { - return String.format("Azure-SDK-For-Java/%s OS:%s MacAddressHash:%s Java:%s", - getClass().getPackage().getImplementationVersion(), - OS, - MAC_ADDRESS_HASH, - JAVA_VERSION); - } - - private static final String MAC_ADDRESS_HASH; private static final String OS; private static final String OS_NAME; private static final String OS_VERSION; @@ -78,22 +59,6 @@ public String userAgent() { OS_NAME = System.getProperty("os.name"); OS_VERSION = System.getProperty("os.version"); OS = OS_NAME + "/" + OS_VERSION; - String macAddress = "Unknown"; - try { - Enumeration networks = NetworkInterface.getNetworkInterfaces(); - while (networks.hasMoreElements()) { - NetworkInterface network = networks.nextElement(); - byte[] mac = network.getHardwareAddress(); - - if (mac != null) { - macAddress = getSha256(mac); - break; - } - } - } catch (Throwable t) { - // It's okay ignore mac address hash telemetry - } - MAC_ADDRESS_HASH = macAddress; String version = System.getProperty("java.version"); JAVA_VERSION = version != null ? version : "Unknown"; } @@ -148,7 +113,7 @@ public Context getContext() { * @param type of final result. * @return poller flux for poll result and final result. */ - public PollerFlux, U> getLroResultAsync(Mono>> lroInit, + public PollerFlux, U> getLroResultAsync(Mono>> lroInit, HttpPipeline httpPipeline, Type pollResultType, Type finalResultType) { return PollerFactory.create( @@ -157,25 +122,10 @@ public PollerFlux, U> getLroResultAsync(Mono>> activationOperation(Mono>> lroInit) { - return lroInit.flatMap(fluxSimpleResponse -> Mono.just(fluxSimpleResponse)); - } - - private static String getSha256(byte[] bytes) { - MessageDigest messageDigest; - try { - messageDigest = MessageDigest.getInstance("SHA-256"); - return new HexBinaryAdapter().marshal(messageDigest.digest(bytes)); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } - return "Unknown"; - } - /** * Gets the final result, or an error, based on last async poll response. * diff --git a/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/fluentcore/arm/models/implementation/ExternalChildResourceImpl.java b/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/fluentcore/arm/models/implementation/ExternalChildResourceImpl.java index 9bb674d4a90e..3072ef72c0f0 100644 --- a/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/fluentcore/arm/models/implementation/ExternalChildResourceImpl.java +++ b/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/fluentcore/arm/models/implementation/ExternalChildResourceImpl.java @@ -413,17 +413,6 @@ public Mono invokeTaskAsync(TaskGroup.InvocationContext context) { .doOnNext(createdExternalChild -> externalChild.setPendingOperation(PendingOperation.None)) .map(updatedExternalChild -> updatedExternalChild); case ToBeRemoved: - // With 2.0 runtime, deleteResourceAsync() will be - // returning 'Completable' then use below code instead - // - // return this.externalChild.deleteResourceAsync().doOnCompleted(new Action0() { - // @Override - // public void call() { - // externalChild.setPendingOperation(PendingOperation.None); - // } - // }).andThen(voidObservable()); - // - // TODO: Fix void mono result. return this.externalChild.deleteResourceAsync() .doOnSuccess(aVoid -> externalChild.setPendingOperation(PendingOperation.None)) .map(aVoid -> voidIndexable()); diff --git a/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/fluentcore/package-info.java b/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/fluentcore/package-info.java new file mode 100644 index 000000000000..14e02d949594 --- /dev/null +++ b/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/fluentcore/package-info.java @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +/** + * This package contains the base classes for management sdk. + */ +package com.azure.resourcemanager.resources.fluentcore; diff --git a/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/fluentcore/policy/ProviderRegistrationPolicy.java b/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/fluentcore/policy/ProviderRegistrationPolicy.java index 1943e854e7e4..ac8386bbaf5e 100644 --- a/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/fluentcore/policy/ProviderRegistrationPolicy.java +++ b/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/fluentcore/policy/ProviderRegistrationPolicy.java @@ -66,7 +66,6 @@ public Mono process(HttpPipelineCallContext context, HttpPipelineN } if (cloudError != null && MISSING_SUBSCRIPTION_REGISTRATION.equals(cloudError.getCode())) { - // TODO: add proxy in rest client ResourceManager resourceManager = ResourceManager.authenticate(credential, profile) .withDefaultSubscription(); Pattern providerPattern = Pattern.compile(".*'(.*)'"); diff --git a/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/fluentcore/utils/Utils.java b/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/fluentcore/utils/Utils.java index 665ccaf4e6b0..3f33fafeabf4 100644 --- a/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/fluentcore/utils/Utils.java +++ b/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/fluentcore/utils/Utils.java @@ -4,19 +4,27 @@ package com.azure.resourcemanager.resources.fluentcore.utils; import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.ServiceInterface; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.RestProxy; +import com.azure.core.http.rest.SimpleResponse; import com.azure.core.management.AzureEnvironment; +import com.azure.core.util.FluxUtil; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.resources.fluentcore.arm.ResourceId; import com.azure.resourcemanager.resources.fluentcore.model.Indexable; import com.azure.resourcemanager.resources.models.Subscription; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import java.net.MalformedURLException; +import java.net.URL; +import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; import java.util.Locale; @@ -115,20 +123,48 @@ public static Mono rootResource(Mono stream) * Download a file asynchronously. * * @param url the URL pointing to the file - * @param retrofit the retrofit client + * @param httpPipeline the http pipeline * @return an Observable pointing to the content of the file */ + public static Mono downloadFileAsync(String url, HttpPipeline httpPipeline) { + FileService service = RestProxy.create(FileService.class, httpPipeline); + try { + return service.download(getHost(url), getPathAndQuery(url)) + .flatMap(response -> FluxUtil.collectBytesInByteBufferStream(response.getValue())); + } catch (MalformedURLException ex) { + return Mono.error(() -> ex); + } + } + /** - * Download a file asynchronously. + * Get host from url. * - * @param url the URL pointing to the file - * @param retrofit the retrofit client - * @return an Observable pointing to the content of the file + * @param urlString the url string + * @return the host + * @throws MalformedURLException when url is invalid format */ - public static Mono downloadFileAsync(String url, HttpPipeline retrofit) { - FileService service = RestProxy.create(FileService.class, retrofit); - Mono response = service.download(url); - return response.flatMap(httpResponse -> httpResponse.getBodyAsByteArray()); + public static String getHost(String urlString) throws MalformedURLException { + URL url = new URL(urlString); + String protocol = url.getProtocol(); + String host = url.getAuthority(); + return protocol + "://" + host; + } + + /** + * Get path from url. + * + * @param urlString the url string + * @return the path + * @throws MalformedURLException when the url is invalid format + */ + public static String getPathAndQuery(String urlString) throws MalformedURLException { + URL url = new URL(urlString); + String path = url.getPath(); + String query = url.getQuery(); + if (query != null && !query.isEmpty()) { + path = path + "?" + query; + } + return path; } /** @@ -185,9 +221,12 @@ public static String resourceGroupId(String id) { /** * A Retrofit service used to download a file. */ + @Host("{$host}") + @ServiceInterface(name = "FileService") private interface FileService { - @Get("{url}") - Mono download(@PathParam("url") String url); + @Get("{path}") + Mono>> download( + @HostParam("$host") String host, @PathParam(value = "path", encoded = true) String path); } /** diff --git a/sdk/resources/mgmt/src/test/java/com/azure/resourcemanager/resources/ResourceUtilsTests.java b/sdk/resources/mgmt/src/test/java/com/azure/resourcemanager/resources/ResourceUtilsTests.java index 677803cd1233..651898b9150d 100644 --- a/sdk/resources/mgmt/src/test/java/com/azure/resourcemanager/resources/ResourceUtilsTests.java +++ b/sdk/resources/mgmt/src/test/java/com/azure/resourcemanager/resources/ResourceUtilsTests.java @@ -3,12 +3,20 @@ package com.azure.resourcemanager.resources; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.RetryPolicy; import com.azure.core.management.AzureEnvironment; import com.azure.resourcemanager.resources.fluentcore.arm.ResourceUtils; import com.azure.resourcemanager.resources.fluentcore.utils.Utils; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import java.time.temporal.ChronoUnit; + public class ResourceUtilsTests { @Test public void canExtractGroupFromId() throws Exception { @@ -39,11 +47,16 @@ public void canExtractRelativePathFromId() throws Exception { @Test public void canDownloadFile() throws Exception { - // TODO(not known): Fix this -// RestProxy retrofit = new RestProxyBuilder().baseUrl("http://microsoft.com").addCallAdapterFactory(RxJavaCallAdapterFactory.create()).build(); -// byte[] content = Utils.downloadFileAsync("http://google.com/humans.txt", retrofit).toBlocking().single(); -// String contentString = new String(content); -// Assertions.assertNotNull(contentString); + HttpPipeline httpPipeline = new HttpPipelineBuilder() + .policies( + new HttpLoggingPolicy(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)), + new RetryPolicy("Retry-After", ChronoUnit.SECONDS) + ) + .build(); + byte[] content = Utils.downloadFileAsync("https://www.google.com/humans.txt", httpPipeline).block(); + String contentString = new String(content); + Assertions.assertNotNull(contentString); + Assertions.assertTrue(contentString.startsWith("Google is built by a large team of engineers,")); } @Test diff --git a/sdk/schemaregistry/azure-data-schemaregistry/pom.xml b/sdk/schemaregistry/azure-data-schemaregistry/pom.xml index 4adb5d427f24..da7a5bbafd86 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/pom.xml +++ b/sdk/schemaregistry/azure-data-schemaregistry/pom.xml @@ -47,7 +47,7 @@ com.azure azure-core - 1.6.0 + 1.7.0-beta.1 com.azure diff --git a/sdk/search/azure-search-documents/README.md b/sdk/search/azure-search-documents/README.md index 3105eed5d246..3c03e0a53da1 100644 --- a/sdk/search/azure-search-documents/README.md +++ b/sdk/search/azure-search-documents/README.md @@ -102,7 +102,7 @@ The SDK provides three clients. To create a `SearchIndexClient/SearchIndexAsyncClient`, you will need the values of the Azure Cognitive Search service URL endpoint and admin key. - + ```Java SearchIndexClient searchIndexClient = new SearchIndexClientBuilder() .endpoint(endpoint) @@ -112,7 +112,7 @@ SearchIndexClient searchIndexClient = new SearchIndexClientBuilder() or - + ```Java SearchIndexAsyncClient searchIndexAsyncClient = new SearchIndexClientBuilder() .endpoint(endpoint) @@ -125,7 +125,7 @@ SearchIndexAsyncClient searchIndexAsyncClient = new SearchIndexClientBuilder() To create a `SearchIndexerClient/SearchIndexerAsyncClient`, you will need the values of the Azure Cognitive Search service URL endpoint and admin key. - + ```Java SearchIndexerClient searchIndexerClient = new SearchIndexerClientBuilder() .endpoint(endpoint) @@ -135,7 +135,7 @@ SearchIndexerClient searchIndexerClient = new SearchIndexerClientBuilder() or - + ```Java SearchIndexerAsyncClient searchIndexerAsyncClient = new SearchIndexerClientBuilder() .endpoint(endpoint) @@ -148,7 +148,7 @@ SearchIndexerAsyncClient searchIndexerAsyncClient = new SearchIndexerClientBuild Once you have the values of the Azure Cognitive Search service URL endpoint and admin key, you can create the `SearchClient/SearchAsyncClient` with an existing index name: - + ```Java SearchClient searchClient = new SearchClientBuilder() .endpoint(endpoint) @@ -159,7 +159,7 @@ SearchClient searchClient = new SearchClientBuilder() or - + ```Java SearchAsyncClient searchAsyncClient = new SearchClientBuilder() .endpoint(endpoint) @@ -174,7 +174,7 @@ To get running immediately, we're going to connect to a well-known sandbox Search service provided by Microsoft. This means you do not need an Azure subscription or Azure Cognitive Search service to try out this query. - + ```Java // We'll connect to the Azure Cognitive Search public sandbox and send a // query to its "nycjobs" index built from a public dataset of available jobs @@ -258,7 +258,7 @@ Let's explore them with a search for a "luxury" hotel. provide your own. Here we perform the search, enumerate over the results, and extract data using `SearchDocument`'s dictionary indexer. - + ```Java SearchPagedIterable searchResultsIterable = searchClient.search("luxury"); for (SearchResult searchResult: searchResultsIterable) { @@ -271,7 +271,7 @@ for (SearchResult searchResult: searchResultsIterable) { #### Use Java model class for search results Define a `Hotel` class. - + ```Java public class Hotel { private String id; @@ -298,7 +298,7 @@ public class Hotel { ``` And use them in place of `SearchDocument` when querying. - + ```Java SearchPagedIterable searchResultsIterable = searchClient.search("luxury"); for (SearchResult searchResult: searchResultsIterable) { @@ -317,7 +317,7 @@ is recommended. The `SearchOptions` provide powerful control over the behavior of our queries. Let's search for the top 5 luxury hotels with a good rating. - + ```Java int stars = 4; SearchOptions options = new SearchOptions() @@ -334,58 +334,58 @@ You can use the [`SearchIndexClient`](#Create-a-SearchIndexClient) to create a s defined using convenient `SimpleField`, `SearchableField`, or `ComplexField` classes. Indexes can also define suggesters, lexical analyzers, and more. - + ```Java - searchFieldList.add(new SimpleFieldBuilder("hotelId", SearchFieldDataType.STRING, false) - .setKey(true) - .setFilterable(true) - .setSortable(true) - .build()); - searchFieldList.add(new SearchableFieldBuilder("hotelName", false) - .setFilterable(true) - .setSortable(true) - .build()); - searchFieldList.add(new SearchableFieldBuilder("description", false) - .setAnalyzerName(LexicalAnalyzerName.EU_LUCENE) - .build()); - searchFieldList.add(new SearchableFieldBuilder("tags", true) - .setKey(true) - .setFilterable(true) - .setFacetable(true) - .build()); - searchFieldList.add(new ComplexFieldBuilder("address", false) - .setFields(Arrays.asList( - new SearchableFieldBuilder("streetAddress", false).build(), - new SearchableFieldBuilder("city", false) - .setFilterable(true) - .setFacetable(true) - .setSortable(true) - .build(), - new SearchableFieldBuilder("stateProvince", false) - .setFilterable(true) - .setFacetable(true) - .setSortable(true) - .build(), - new SearchableFieldBuilder("country", false) - .setFilterable(true) - .setFacetable(true) - .setSortable(true) - .build(), - new SearchableFieldBuilder("postalCode", false) - .setFilterable(true) - .setFacetable(true) - .setSortable(true) - .build() - )) - .build()); - // Prepare suggester. - SearchSuggester suggester = new SearchSuggester("sg", Collections.singletonList("hotelName")); - // Prepare SearchIndex with index name and search fields. - SearchIndex index = new SearchIndex("hotels").setFields(searchFieldList).setSuggesters( - Collections.singletonList(suggester)); - // Create an index - searchIndexClient.createIndex(index); - } + List searchFieldList = new ArrayList<>(); + searchFieldList.add(new SearchField("hotelId", SearchFieldDataType.STRING) + .setKey(true) + .setFilterable(true) + .setSortable(true)); + + searchFieldList.add(new SearchField("hotelName", SearchFieldDataType.STRING) + .setSearchable(true) + .setFilterable(true) + .setSortable(true)); + searchFieldList.add(new SearchField("description", SearchFieldDataType.STRING) + .setSearchable(true) + .setAnalyzerName(LexicalAnalyzerName.EU_LUCENE)); + searchFieldList.add(new SearchField("tags", SearchFieldDataType.collection(SearchFieldDataType.STRING)) + .setSearchable(true) + .setKey(true) + .setFilterable(true) + .setFacetable(true)); + searchFieldList.add(new SearchField("address", SearchFieldDataType.COMPLEX) + .setFields(Arrays.asList( + new SearchField("streetAddress", SearchFieldDataType.STRING).setSearchable(true), + new SearchField("city", SearchFieldDataType.STRING) + .setSearchable(true) + .setFilterable(true) + .setFacetable(true) + .setSortable(true), + new SearchField("stateProvince", SearchFieldDataType.STRING) + .setSearchable(true) + .setFilterable(true) + .setFacetable(true) + .setSortable(true), + new SearchField("country", SearchFieldDataType.STRING) + .setSearchable(true) + .setFilterable(true) + .setFacetable(true) + .setSortable(true), + new SearchField("postalCode", SearchFieldDataType.STRING) + .setSearchable(true) + .setFilterable(true) + .setFacetable(true) + .setSortable(true) + ))); + + // Prepare suggester. + SearchSuggester suggester = new SearchSuggester("sg", Collections.singletonList("hotelName")); + // Prepare SearchIndex with index name and search fields. + SearchIndex index = new SearchIndex("hotels").setFields(searchFieldList).setSuggesters( + Collections.singletonList(suggester)); + // Create an index + searchIndexClient.createIndex(index); } ``` @@ -396,7 +396,7 @@ you can retrieve a specific document from your index if you already know the key. You could get the key from a query, for example, and want to show more information about it or navigate your customer to that document. - + ```Java Hotel hotel = searchClient.getDocument("1", Hotel.class); System.out.printf("This is hotelId %s, and this is hotel name %s.%n", hotel.getId(), hotel.getName()); @@ -409,11 +409,11 @@ an index in a single batched request. There are [a few special rules for merging](https://docs.microsoft.com/rest/api/searchservice/addupdate-or-delete-documents#document-actions) to be aware of. - + ```Java IndexDocumentsBatch batch = new IndexDocumentsBatch(); -batch.addUploadActions(new Hotel().setId("783").setName("Upload Inn")); -batch.addMergeActions(new Hotel().setId("12").setName("Renovated Ranch")); +batch.addUploadActions(Collections.singletonList(new Hotel().setId("783").setName("Upload Inn"))); +batch.addMergeActions(Collections.singletonList(new Hotel().setId("12").setName("Renovated Ranch"))); searchClient.indexDocuments(batch); ``` @@ -428,7 +428,7 @@ with an `IndexDocumentsResult` for inspection. All of the examples so far have been using synchronous APIs, but we provide full support for async APIs as well. You'll need to use [SearchAsyncClient](#Create-a-SearchClient) - + ```Java searchAsyncClient.search("luxury") .subscribe(result -> { @@ -452,7 +452,7 @@ Any Search API operation that fails will throw a [`HttpResponseException`][HttpResponseException] with helpful [`Status codes`][status_codes]. Many of these errors are recoverable. - + ```Java try { Iterable results = searchClient.search("hotel"); diff --git a/sdk/search/azure-search-documents/pom.xml b/sdk/search/azure-search-documents/pom.xml index 41d86df154d4..6491151c189a 100644 --- a/sdk/search/azure-search-documents/pom.xml +++ b/sdk/search/azure-search-documents/pom.xml @@ -28,7 +28,7 @@ com.azure azure-core - 1.6.0 + 1.7.0-beta.1 com.azure 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 eff449625e7f..66950b98e0b9 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 @@ -704,9 +704,8 @@ private static Map> getFacets(SearchDocumentsResult re Map> facets = new HashMap<>(); - result.getFacets().forEach((key, values) -> { - facets.put(key, values.stream().map(FacetResultConverter::map).collect(Collectors.toList())); - }); + result.getFacets().forEach((key, values) -> + facets.put(key, values.stream().map(FacetResultConverter::map).collect(Collectors.toList()))); return facets; } @@ -951,10 +950,11 @@ private static AutocompleteRequest createAutoCompleteRequest(String searchText, } private static IndexDocumentsBatch buildIndexBatch(Iterable documents, IndexActionType actionType) { - List> actions = new ArrayList>(); + List> actions = new ArrayList<>(); documents.forEach(d -> actions.add(new IndexAction() .setActionType(actionType) .setDocument(d))); - return new IndexDocumentsBatch(actions); + + return new IndexDocumentsBatch().addActions(actions); } } diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/AnalyzeRequestConverter.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/AnalyzeRequestConverter.java index 8827b9207541..5dcc1e5e3e1e 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/AnalyzeRequestConverter.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/AnalyzeRequestConverter.java @@ -35,16 +35,16 @@ public static AnalyzeTextOptions map(com.azure.search.documents.indexes.implemen } if (obj.getCharFilters() != null) { - List charFilters = - obj.getCharFilters().stream().map(CharFilterNameConverter::map).collect(Collectors.toList()); - analyzeTextOptions.setCharFilters(charFilters); + analyzeTextOptions.setCharFilters(obj.getCharFilters().stream() + .map(CharFilterNameConverter::map) + .toArray(CharFilterName[]::new)); } if (obj.getTokenFilters() != null) { - List tokenFilters = - obj.getTokenFilters().stream().map(TokenFilterNameConverter::map).collect(Collectors.toList()); - analyzeTextOptions.setTokenFilters(tokenFilters); + analyzeTextOptions.setTokenFilters(obj.getTokenFilters().stream() + .map(TokenFilterNameConverter::map) + .toArray(TokenFilterName[]::new)); } diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/CjkBigramTokenFilterConverter.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/CjkBigramTokenFilterConverter.java index 3f36516036f6..ca45d321dc27 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/CjkBigramTokenFilterConverter.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/CjkBigramTokenFilterConverter.java @@ -4,7 +4,6 @@ package com.azure.search.documents.implementation.converters; import com.azure.search.documents.indexes.models.CjkBigramTokenFilter; -import com.azure.search.documents.indexes.models.CjkBigramTokenFilterScripts; import java.util.List; import java.util.stream.Collectors; @@ -28,9 +27,9 @@ public static CjkBigramTokenFilter map(com.azure.search.documents.indexes.implem cjkBigramTokenFilter.setOutputUnigrams(outputUnigrams); if (obj.getIgnoreScripts() != null) { - List ignoreScripts = - obj.getIgnoreScripts().stream().map(CjkBigramTokenFilterScriptsConverter::map).collect(Collectors.toList()); - cjkBigramTokenFilter.setIgnoreScripts(ignoreScripts); + cjkBigramTokenFilter.setIgnoreScripts(obj.getIgnoreScripts().stream() + .map(CjkBigramTokenFilterScriptsConverter::map) + .collect(Collectors.toList())); } return cjkBigramTokenFilter; } diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/EdgeNGramTokenizerConverter.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/EdgeNGramTokenizerConverter.java index 9237bb4bff09..2629716afe66 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/EdgeNGramTokenizerConverter.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/EdgeNGramTokenizerConverter.java @@ -4,7 +4,6 @@ package com.azure.search.documents.implementation.converters; import com.azure.search.documents.indexes.models.EdgeNGramTokenizer; -import com.azure.search.documents.indexes.models.TokenCharacterKind; import java.util.List; import java.util.stream.Collectors; @@ -28,9 +27,9 @@ public static EdgeNGramTokenizer map(com.azure.search.documents.indexes.implemen edgeNGramTokenizer.setMaxGram(maxGram); if (obj.getTokenChars() != null) { - List tokenChars = - obj.getTokenChars().stream().map(TokenCharacterKindConverter::map).collect(Collectors.toList()); - edgeNGramTokenizer.setTokenChars(tokenChars); + edgeNGramTokenizer.setTokenChars(obj.getTokenChars().stream() + .map(TokenCharacterKindConverter::map) + .collect(Collectors.toList())); } Integer minGram = obj.getMinGram(); diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/ElisionTokenFilterConverter.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/ElisionTokenFilterConverter.java index fd274a727534..5b04318783c5 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/ElisionTokenFilterConverter.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/ElisionTokenFilterConverter.java @@ -24,8 +24,7 @@ public static ElisionTokenFilter map(com.azure.search.documents.indexes.implemen ElisionTokenFilter elisionTokenFilter = new ElisionTokenFilter(obj.getName()); if (obj.getArticles() != null) { - List articles = new ArrayList<>(obj.getArticles()); - elisionTokenFilter.setArticles(articles); + elisionTokenFilter.setArticles(obj.getArticles()); } return elisionTokenFilter; } diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/EntityRecognitionSkillConverter.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/EntityRecognitionSkillConverter.java index 17c91d75a62d..42e15524b92d 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/EntityRecognitionSkillConverter.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/EntityRecognitionSkillConverter.java @@ -3,7 +3,6 @@ package com.azure.search.documents.implementation.converters; -import com.azure.search.documents.indexes.models.EntityCategory; import com.azure.search.documents.indexes.models.EntityRecognitionSkill; import com.azure.search.documents.indexes.models.EntityRecognitionSkillLanguage; import com.azure.search.documents.indexes.models.InputFieldMappingEntry; @@ -52,9 +51,9 @@ public static EntityRecognitionSkill map(com.azure.search.documents.indexes.impl } if (obj.getCategories() != null) { - List categories = - obj.getCategories().stream().map(EntityCategoryConverter::map).collect(Collectors.toList()); - entityRecognitionSkill.setCategories(categories); + entityRecognitionSkill.setCategories(obj.getCategories().stream() + .map(EntityCategoryConverter::map) + .collect(Collectors.toList())); } Double minimumPrecision = obj.getMinimumPrecision(); diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/ImageAnalysisSkillConverter.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/ImageAnalysisSkillConverter.java index ddb96e58578d..76eabdc29d13 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/ImageAnalysisSkillConverter.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/ImageAnalysisSkillConverter.java @@ -5,10 +5,8 @@ import com.azure.search.documents.indexes.models.ImageAnalysisSkill; import com.azure.search.documents.indexes.models.ImageAnalysisSkillLanguage; -import com.azure.search.documents.indexes.models.ImageDetail; import com.azure.search.documents.indexes.models.InputFieldMappingEntry; import com.azure.search.documents.indexes.models.OutputFieldMappingEntry; -import com.azure.search.documents.indexes.models.VisualFeature; import java.util.List; import java.util.stream.Collectors; @@ -44,9 +42,9 @@ public static ImageAnalysisSkill map(com.azure.search.documents.indexes.implemen imageAnalysisSkill.setDescription(description); if (obj.getVisualFeatures() != null) { - List visualFeatures = - obj.getVisualFeatures().stream().map(VisualFeatureConverter::map).collect(Collectors.toList()); - imageAnalysisSkill.setVisualFeatures(visualFeatures); + imageAnalysisSkill.setVisualFeatures(obj.getVisualFeatures().stream() + .map(VisualFeatureConverter::map) + .collect(Collectors.toList())); } if (obj.getDefaultLanguageCode() != null) { @@ -56,9 +54,9 @@ public static ImageAnalysisSkill map(com.azure.search.documents.indexes.implemen } if (obj.getDetails() != null) { - List details = - obj.getDetails().stream().map(ImageDetailConverter::map).collect(Collectors.toList()); - imageAnalysisSkill.setDetails(details); + imageAnalysisSkill.setDetails(obj.getDetails().stream() + .map(ImageDetailConverter::map) + .collect(Collectors.toList())); } return imageAnalysisSkill; } diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/LuceneStandardAnalyzerConverter.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/LuceneStandardAnalyzerConverter.java index 3a3eb17a747d..3e092e9c830d 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/LuceneStandardAnalyzerConverter.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/LuceneStandardAnalyzerConverter.java @@ -27,8 +27,7 @@ public static LuceneStandardAnalyzer map(com.azure.search.documents.indexes.impl luceneStandardAnalyzer.setMaxTokenLength(maxTokenLength); if (obj.getStopwords() != null) { - List stopwords = new ArrayList<>(obj.getStopwords()); - luceneStandardAnalyzer.setStopwords(stopwords); + luceneStandardAnalyzer.setStopwords(obj.getStopwords()); } return luceneStandardAnalyzer; } diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/NGramTokenizerConverter.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/NGramTokenizerConverter.java index 11d9135727dd..7c551de884b6 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/NGramTokenizerConverter.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/NGramTokenizerConverter.java @@ -4,7 +4,6 @@ package com.azure.search.documents.implementation.converters; import com.azure.search.documents.indexes.models.NGramTokenizer; -import com.azure.search.documents.indexes.models.TokenCharacterKind; import java.util.List; import java.util.stream.Collectors; @@ -27,9 +26,9 @@ public static NGramTokenizer map(com.azure.search.documents.indexes.implementati nGramTokenizer.setMaxGram(maxGram); if (obj.getTokenChars() != null) { - List tokenChars = - obj.getTokenChars().stream().map(TokenCharacterKindConverter::map).collect(Collectors.toList()); - nGramTokenizer.setTokenChars(tokenChars); + nGramTokenizer.setTokenChars(obj.getTokenChars().stream() + .map(TokenCharacterKindConverter::map) + .collect(Collectors.toList())); } Integer minGram = obj.getMinGram(); diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/PatternAnalyzerConverter.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/PatternAnalyzerConverter.java index 3c629c15b7b5..591825343514 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/PatternAnalyzerConverter.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/PatternAnalyzerConverter.java @@ -32,14 +32,13 @@ public static PatternAnalyzer map(com.azure.search.documents.indexes.implementat patternAnalyzer.setPattern(pattern); if (obj.getFlags() != null) { - List regexFlags = - Arrays.stream(obj.getFlags().toString().split("\\|")).map(RegexFlags::fromString).collect(Collectors.toList()); - patternAnalyzer.setFlags(regexFlags); + patternAnalyzer.setFlags(Arrays.stream(obj.getFlags().toString().split("\\|")) + .map(RegexFlags::fromString) + .collect(Collectors.toList())); } if (obj.getStopwords() != null) { - List stopwords = new ArrayList<>(obj.getStopwords()); - patternAnalyzer.setStopwords(stopwords); + patternAnalyzer.setStopwords(obj.getStopwords()); } return patternAnalyzer; } diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/PatternTokenizerConverter.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/PatternTokenizerConverter.java index 89cf03629166..5f0aeb5a9104 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/PatternTokenizerConverter.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/PatternTokenizerConverter.java @@ -7,7 +7,6 @@ import com.azure.search.documents.indexes.models.RegexFlags; import java.util.Arrays; -import java.util.List; import java.util.stream.Collectors; /** @@ -28,9 +27,9 @@ public static PatternTokenizer map(com.azure.search.documents.indexes.implementa patternTokenizer.setPattern(pattern); if (obj.getFlags() != null) { - List regexFlags = - Arrays.stream(obj.getFlags().toString().split("\\|")).map(RegexFlags::fromString).collect(Collectors.toList()); - patternTokenizer.setFlags(regexFlags); + patternTokenizer.setFlags(Arrays.stream(obj.getFlags().toString().split("\\|")) + .map(RegexFlags::fromString) + .collect(Collectors.toList())); } Integer group = obj.getGroup(); diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/ScoringProfileConverter.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/ScoringProfileConverter.java index 78fc6dd367ac..610eb69f6b8c 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/ScoringProfileConverter.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/ScoringProfileConverter.java @@ -3,7 +3,6 @@ package com.azure.search.documents.implementation.converters; -import com.azure.search.documents.indexes.models.ScoringFunction; import com.azure.search.documents.indexes.models.ScoringFunctionAggregation; import com.azure.search.documents.indexes.models.ScoringProfile; import com.azure.search.documents.indexes.models.TextWeights; @@ -26,9 +25,9 @@ public static ScoringProfile map(com.azure.search.documents.indexes.implementati ScoringProfile scoringProfile = new ScoringProfile(obj.getName()); if (obj.getFunctions() != null) { - List functions = - obj.getFunctions().stream().map(ScoringFunctionConverter::map).collect(Collectors.toList()); - scoringProfile.setFunctions(functions); + scoringProfile.setFunctions(obj.getFunctions().stream() + .map(ScoringFunctionConverter::map) + .collect(Collectors.toList())); } if (obj.getTextWeights() != null) { diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/StopAnalyzerConverter.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/StopAnalyzerConverter.java index 2b8f8495b1d5..e59cab202029 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/StopAnalyzerConverter.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/StopAnalyzerConverter.java @@ -22,8 +22,7 @@ public static StopAnalyzer map(com.azure.search.documents.indexes.implementation StopAnalyzer stopAnalyzer = new StopAnalyzer(obj.getName()); if (obj.getStopwords() != null) { - List stopwords = new ArrayList<>(obj.getStopwords()); - stopAnalyzer.setStopwords(stopwords); + stopAnalyzer.setStopwords(obj.getStopwords()); } return stopAnalyzer; } diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/WordDelimiterTokenFilterConverter.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/WordDelimiterTokenFilterConverter.java index 988967cd2d35..a8f0aff32e22 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/WordDelimiterTokenFilterConverter.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/converters/WordDelimiterTokenFilterConverter.java @@ -27,8 +27,7 @@ public static WordDelimiterTokenFilter map(com.azure.search.documents.indexes.im wordDelimiterTokenFilter.setNumbersCatenated(catenateNumbers); if (obj.getProtectedWords() != null) { - List protectedWords = new ArrayList<>(obj.getProtectedWords()); - wordDelimiterTokenFilter.setProtectedWords(protectedWords); + wordDelimiterTokenFilter.setProtectedWords(obj.getProtectedWords()); } Boolean generateNumberParts = obj.isGenerateNumberParts(); diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AnalyzeTextOptions.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AnalyzeTextOptions.java index 4039507f1429..a7255502772b 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AnalyzeTextOptions.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AnalyzeTextOptions.java @@ -5,6 +5,8 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Arrays; import java.util.List; /** @@ -201,8 +203,8 @@ public List getTokenFilters() { * @param tokenFilters the tokenFilters value to set. * @return the AnalyzeRequest object itself. */ - public AnalyzeTextOptions setTokenFilters(List tokenFilters) { - this.tokenFilters = tokenFilters; + public AnalyzeTextOptions setTokenFilters(TokenFilterName... tokenFilters) { + this.tokenFilters = (tokenFilters == null) ? null : Arrays.asList(tokenFilters); return this; } @@ -225,8 +227,8 @@ public List getCharFilters() { * @param charFilters the charFilters value to set. * @return the AnalyzeRequest object itself. */ - public AnalyzeTextOptions setCharFilters(List charFilters) { - this.charFilters = charFilters; + public AnalyzeTextOptions setCharFilters(CharFilterName... charFilters) { + this.charFilters = (charFilters == null) ? null : Arrays.asList(charFilters); return this; } } diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/CjkBigramTokenFilter.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/CjkBigramTokenFilter.java index 65d3b31763e9..9df7360dac2f 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/CjkBigramTokenFilter.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/CjkBigramTokenFilter.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; + +import java.util.Arrays; import java.util.List; /** @@ -58,6 +61,18 @@ public List getIgnoreScripts() { * @param ignoreScripts the ignoreScripts value to set. * @return the CjkBigramTokenFilter object itself. */ + public CjkBigramTokenFilter setIgnoreScripts(CjkBigramTokenFilterScripts... ignoreScripts) { + this.ignoreScripts = (ignoreScripts == null) ? null : Arrays.asList(ignoreScripts); + return this; + } + + /** + * Set the ignoreScripts property: The scripts to ignore. + * + * @param ignoreScripts the ignoreScripts value to set. + * @return the CjkBigramTokenFilter object itself. + */ + @JsonSetter public CjkBigramTokenFilter setIgnoreScripts(List ignoreScripts) { this.ignoreScripts = ignoreScripts; return this; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/ComplexFieldBuilder.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/ComplexFieldBuilder.java deleted file mode 100644 index b558ba5ae42a..000000000000 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/ComplexFieldBuilder.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.search.documents.indexes.models; - -import java.util.List; - -/** - * A helper Field model to build a complex field which uses {@code SearchFieldDataType.EDM_COMPLEX_TYPE} or - * collection of {@code SearchFieldDataType.EDM_COMPLEX_TYPE}. - */ -public class ComplexFieldBuilder extends SearchFieldBase { - private List fields; - - /** - * Initializes a new instance of the {@link ComplexFieldBuilder} class. - * - * @param name The name of the field, which must be unique within the index or parent field. - * @param collection Whether the field is a collection of strings. - */ - public ComplexFieldBuilder(String name, boolean collection) { - super(name, collection ? SearchFieldDataType.collection(SearchFieldDataType.COMPLEX) - : SearchFieldDataType.COMPLEX); - } - - /** - * Gets a collection of {@link SimpleFieldBuilder} or {@link ComplexFieldBuilder} child fields. - * - * @return The list of sub-fields. - */ - public List getFields() { - return fields; - } - - /** - * Sets a collection of {@link SimpleFieldBuilder} or {@link ComplexFieldBuilder} child fields. - * - * @param fields The list of sub-fields. - * @return The {@link ComplexFieldBuilder} object itself. - */ - public ComplexFieldBuilder setFields(List fields) { - this.fields = fields; - return this; - } - - /** - * Convert ComplexField to {@link SearchField}. - * - * @return The {@link SearchField} object. - */ - public SearchField build() { - return new SearchField(super.getName(), super.getDataType()) - .setFields(fields); - } -} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/CustomAnalyzer.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/CustomAnalyzer.java index e6bab959e9fd..a5295162b851 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/CustomAnalyzer.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/CustomAnalyzer.java @@ -5,8 +5,11 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; + +import java.util.Arrays; import java.util.List; /** @@ -102,6 +105,21 @@ public List getTokenFilters() { * @param tokenFilters the tokenFilters value to set. * @return the CustomAnalyzer object itself. */ + public CustomAnalyzer setTokenFilters(TokenFilterName... tokenFilters) { + this.tokenFilters = (tokenFilters == null) ? null : Arrays.asList(tokenFilters); + return this; + } + + /** + * Set the tokenFilters property: A list of token filters used to filter + * out or modify the tokens generated by a tokenizer. For example, you can + * specify a lowercase filter that converts all characters to lowercase. + * The filters are run in the order in which they are listed. + * + * @param tokenFilters the tokenFilters value to set. + * @return the CustomAnalyzer object itself. + */ + @JsonSetter public CustomAnalyzer setTokenFilters(List tokenFilters) { this.tokenFilters = tokenFilters; return this; @@ -128,6 +146,21 @@ public List getCharFilters() { * @param charFilters the charFilters value to set. * @return the CustomAnalyzer object itself. */ + public CustomAnalyzer setCharFilters(CharFilterName... charFilters) { + this.charFilters = (charFilters == null) ? null : Arrays.asList(charFilters); + return this; + } + + /** + * Set the charFilters property: A list of character filters used to + * prepare input text before it is processed by the tokenizer. For + * instance, they can replace certain characters or symbols. The filters + * are run in the order in which they are listed. + * + * @param charFilters the charFilters value to set. + * @return the CustomAnalyzer object itself. + */ + @JsonSetter public CustomAnalyzer setCharFilters(List charFilters) { this.charFilters = charFilters; return this; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/EdgeNGramTokenizer.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/EdgeNGramTokenizer.java index 67fed3cf4f00..25ff7da87421 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/EdgeNGramTokenizer.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/EdgeNGramTokenizer.java @@ -5,8 +5,11 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; + +import java.util.Arrays; import java.util.List; /** @@ -106,6 +109,18 @@ public List getTokenChars() { * @param tokenChars the tokenChars value to set. * @return the EdgeNGramTokenizer object itself. */ + public EdgeNGramTokenizer setTokenChars(TokenCharacterKind... tokenChars) { + this.tokenChars = (tokenChars == null) ? null : Arrays.asList(tokenChars); + return this; + } + + /** + * Set the tokenChars property: Character classes to keep in the tokens. + * + * @param tokenChars the tokenChars value to set. + * @return the EdgeNGramTokenizer object itself. + */ + @JsonSetter public EdgeNGramTokenizer setTokenChars(List tokenChars) { this.tokenChars = tokenChars; return this; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/ElisionTokenFilter.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/ElisionTokenFilter.java index 98dcbaa63db1..738470979066 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/ElisionTokenFilter.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/ElisionTokenFilter.java @@ -5,8 +5,11 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; + +import java.util.Arrays; import java.util.List; /** @@ -49,6 +52,18 @@ public List getArticles() { * @param articles the articles value to set. * @return the ElisionTokenFilter object itself. */ + public ElisionTokenFilter setArticles(String... articles) { + this.articles = (articles == null) ? null : Arrays.asList(articles); + return this; + } + + /** + * Set the articles property: The set of articles to remove. + * + * @param articles the articles value to set. + * @return the ElisionTokenFilter object itself. + */ + @JsonSetter public ElisionTokenFilter setArticles(List articles) { this.articles = articles; return this; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/EntityRecognitionSkill.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/EntityRecognitionSkill.java index d7cc6773e864..5e572dad917e 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/EntityRecognitionSkill.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/EntityRecognitionSkill.java @@ -5,8 +5,11 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; + +import java.util.Arrays; import java.util.List; /** @@ -76,6 +79,19 @@ public List getCategories() { * @param categories the categories value to set. * @return the EntityRecognitionSkill object itself. */ + public EntityRecognitionSkill setCategories(EntityCategory... categories) { + this.categories = (categories == null) ? null : Arrays.asList(categories); + return this; + } + + /** + * Set the categories property: A list of entity categories that should be + * extracted. + * + * @param categories the categories value to set. + * @return the EntityRecognitionSkill object itself. + */ + @JsonSetter public EntityRecognitionSkill setCategories(List categories) { this.categories = categories; return this; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/ImageAnalysisSkill.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/ImageAnalysisSkill.java index 45eea7cd1fe2..e86bd6c40f5a 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/ImageAnalysisSkill.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/ImageAnalysisSkill.java @@ -5,8 +5,11 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; + +import java.util.Arrays; import java.util.List; /** @@ -87,6 +90,18 @@ public List getVisualFeatures() { * @param visualFeatures the visualFeatures value to set. * @return the ImageAnalysisSkill object itself. */ + public ImageAnalysisSkill setVisualFeatures(VisualFeature... visualFeatures) { + this.visualFeatures = (visualFeatures == null) ? null : Arrays.asList(visualFeatures); + return this; + } + + /** + * Set the visualFeatures property: A list of visual features. + * + * @param visualFeatures the visualFeatures value to set. + * @return the ImageAnalysisSkill object itself. + */ + @JsonSetter public ImageAnalysisSkill setVisualFeatures(List visualFeatures) { this.visualFeatures = visualFeatures; return this; @@ -109,6 +124,19 @@ public List getDetails() { * @param details the details value to set. * @return the ImageAnalysisSkill object itself. */ + public ImageAnalysisSkill setDetails(ImageDetail... details) { + this.details = (details == null) ? null : Arrays.asList(details); + return this; + } + + /** + * Set the details property: A string indicating which domain-specific + * details to return. + * + * @param details the details value to set. + * @return the ImageAnalysisSkill object itself. + */ + @JsonSetter public ImageAnalysisSkill setDetails(List details) { this.details = details; return this; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/IndexDocumentsBatch.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/IndexDocumentsBatch.java index 038738b4d1d2..857e1237157e 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/IndexDocumentsBatch.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/IndexDocumentsBatch.java @@ -10,8 +10,6 @@ import com.azure.search.documents.models.IndexBatchBase; import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; /** * Contains a batch of document write actions to send to the index. @@ -22,35 +20,25 @@ public class IndexDocumentsBatch extends IndexBatchBase { * Constructor of {@link IndexDocumentsBatch}. */ public IndexDocumentsBatch() { - super(new ArrayList>()); + super(new ArrayList<>()); } /** - * Constructor of {@link IndexDocumentsBatch} + * Adds document index actions to the batch. * - * @param actions the actions value to set. + * @param actions Index actions. + * @return The updated IndexDocumentsBatch object. */ - public IndexDocumentsBatch(List> actions) { - super(actions); - } - - /** - * Adds an Upload IndexAction to the IndexAction chain for a document. - * - * @param documents The documents to be uploaded. - * @return IndexBatch with the desired actions added. - */ - @SuppressWarnings("unchecked") - public IndexDocumentsBatch addUploadActions(T... documents) { - addDocumentActions(Arrays.asList(documents), IndexActionType.UPLOAD); + public IndexDocumentsBatch addActions(Iterable> actions) { + actions.forEach(action -> this.getActions().add(action)); return this; } /** - * Adds Upload IndexActions to the IndexAction chain for a collection of documents. + * Adds upload document actions to the batch. * - * @param documents The document collection to be uploaded. - * @return IndexBatch with the desired actions added. + * @param documents Documents to be uploaded. + * @return The updated IndexDocumentsBatch object. */ public IndexDocumentsBatch addUploadActions(Iterable documents) { addDocumentActions(documents, IndexActionType.UPLOAD); @@ -58,22 +46,10 @@ public IndexDocumentsBatch addUploadActions(Iterable documents) { } /** - * Adds a Delete IndexAction to the IndexAction chain for a document. - * - * @param documents The documents to be deleted. - * @return IndexBatch with the desired actions added. - */ - @SuppressWarnings("unchecked") - public IndexDocumentsBatch addDeleteActions(T... documents) { - addDocumentActions(Arrays.asList(documents), IndexActionType.DELETE); - return this; - } - - /** - * Adds Delete IndexActions to the IndexAction chain for a collection of documents. + * Adds document delete actions to the batch. * - * @param documents The document collection to be deleted. - * @return IndexBatch with the desired actions added. + * @param documents Document to be deleted. + * @return The updated IndexDocumentsBatch object. */ public IndexDocumentsBatch addDeleteActions(Iterable documents) { addDocumentActions(documents, IndexActionType.DELETE); @@ -81,11 +57,11 @@ public IndexDocumentsBatch addDeleteActions(Iterable documents) { } /** - * Adds Delete IndexActions to the IndexAction chain for a collection of documents. + * Adds document delete actions based on key IDs to the batch. * - * @param keyName The name of the key field that uniquely identifies documents in the index. - * @param keyValues The keys of the documents to delete. - * @return IndexBatch with the desired actions added. + * @param keyName The key field name. + * @param keyValues Keys of the documents to delete. + * @return The updated IndexDocumentsBatch object. */ @SuppressWarnings({"unchecked", "rawtypes"}) public IndexDocumentsBatch addDeleteActions(String keyName, Iterable keyValues) { @@ -101,33 +77,10 @@ public IndexDocumentsBatch addDeleteActions(String keyName, Iterable } /** - * Adds Delete IndexActions to the IndexAction chain for a collection of documents. - * - * @param keyName The name of the key field that uniquely identifies documents in the index. - * @param keyValues The keys of the documents to delete. - * @return IndexBatch with the desired actions added. - */ - public IndexDocumentsBatch addDeleteActions(String keyName, String... keyValues) { - return this.addDeleteActions(keyName, Arrays.asList(keyValues)); - } - - /** - * Adds a Merge IndexAction to the IndexAction chain for a document. - * - * @param documents The documents to be merged. - * @return IndexBatch with the desired actions added. - */ - @SuppressWarnings("unchecked") - public IndexDocumentsBatch addMergeActions(T... documents) { - addDocumentActions(Arrays.asList(documents), IndexActionType.MERGE); - return this; - } - - /** - * Adds Merge IndexActions to the IndexAction chain for a collection of documents. + * Adds merge document actions to the batch.. * - * @param documents The document collection to be merged. - * @return IndexBatch with the desired actions added. + * @param documents Documents to be merged. + * @return The updated IndexDocumentsBatch object. */ public IndexDocumentsBatch addMergeActions(Iterable documents) { addDocumentActions(documents, IndexActionType.MERGE); @@ -135,22 +88,10 @@ public IndexDocumentsBatch addMergeActions(Iterable documents) { } /** - * Adds a Merge or Upload IndexAction to the IndexAction chain for a document. - * - * @param documents The documents to be merged or uploaded. - * @return IndexBatch with the desired actions added. - */ - @SuppressWarnings("unchecked") - public IndexDocumentsBatch addMergeOrUploadActions(T... documents) { - addDocumentActions(Arrays.asList(documents), IndexActionType.MERGE_OR_UPLOAD); - return this; - } - - /** - * Adds Merge or Upload IndexActions to the IndexAction chain for a collection of documents. + * Adds merge or upload document actions to the batch. * - * @param documents The document collection to be merged or uploaded. - * @return IndexBatch with the desired actions added. + * @param documents Documents to be merged or uploaded. + * @return The updated IndexDocumentsBatch object. */ public IndexDocumentsBatch addMergeOrUploadActions(Iterable documents) { addDocumentActions(documents, IndexActionType.MERGE_OR_UPLOAD); @@ -158,10 +99,8 @@ public IndexDocumentsBatch addMergeOrUploadActions(Iterable documents) { } private void addDocumentActions(Iterable documents, IndexActionType actionType) { - documents.forEach(d -> { - this.getActions().add(new IndexAction() - .setActionType(actionType) - .setDocument(d)); - }); + documents.forEach(d -> this.getActions().add(new IndexAction() + .setActionType(actionType) + .setDocument(d))); } } diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/InputFieldMappingEntry.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/InputFieldMappingEntry.java index 27cf9378ef8c..6d3b3d1786db 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/InputFieldMappingEntry.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/InputFieldMappingEntry.java @@ -6,6 +6,9 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; + +import java.util.Arrays; import java.util.List; /** @@ -115,6 +118,19 @@ public List getInputs() { * @param inputs the inputs value to set. * @return the InputFieldMappingEntry object itself. */ + public InputFieldMappingEntry setInputs(InputFieldMappingEntry... inputs) { + this.inputs = (inputs == null) ? null : Arrays.asList(inputs); + return this; + } + + /** + * Set the inputs property: The recursive inputs used when creating a + * complex type. + * + * @param inputs the inputs value to set. + * @return the InputFieldMappingEntry object itself. + */ + @JsonSetter public InputFieldMappingEntry setInputs(List inputs) { this.inputs = inputs; return this; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/LuceneStandardAnalyzer.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/LuceneStandardAnalyzer.java index da9e445230dc..e1bc743ff11d 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/LuceneStandardAnalyzer.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/LuceneStandardAnalyzer.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; + +import java.util.Arrays; import java.util.List; /** @@ -83,6 +86,18 @@ public List getStopwords() { * @param stopwords the stopwords value to set. * @return the LuceneStandardAnalyzer object itself. */ + public LuceneStandardAnalyzer setStopwords(String... stopwords) { + this.stopwords = (stopwords == null) ? null : Arrays.asList(stopwords); + return this; + } + + /** + * Set the stopwords property: A list of stopwords. + * + * @param stopwords the stopwords value to set. + * @return the LuceneStandardAnalyzer object itself. + */ + @JsonSetter public LuceneStandardAnalyzer setStopwords(List stopwords) { this.stopwords = stopwords; return this; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/NGramTokenizer.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/NGramTokenizer.java index fb2bcf1519f6..218e63130f08 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/NGramTokenizer.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/NGramTokenizer.java @@ -5,8 +5,11 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; + +import java.util.Arrays; import java.util.List; /** @@ -106,6 +109,18 @@ public List getTokenChars() { * @param tokenChars the tokenChars value to set. * @return the NGramTokenizer object itself. */ + public NGramTokenizer setTokenChars(TokenCharacterKind... tokenChars) { + this.tokenChars = (tokenChars == null) ? null : Arrays.asList(tokenChars); + return this; + } + + /** + * Set the tokenChars property: Character classes to keep in the tokens. + * + * @param tokenChars the tokenChars value to set. + * @return the NGramTokenizer object itself. + */ + @JsonSetter public NGramTokenizer setTokenChars(List tokenChars) { this.tokenChars = tokenChars; return this; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/PatternAnalyzer.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/PatternAnalyzer.java index 7e76909eb019..be1ac6348ec3 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/PatternAnalyzer.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/PatternAnalyzer.java @@ -5,9 +5,11 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.Arrays; import java.util.List; /** @@ -115,6 +117,18 @@ public List getFlags() { * @param flags the flags value to set. * @return the PatternAnalyzer object itself. */ + public PatternAnalyzer setFlags(RegexFlags... flags) { + this.flags = (flags == null) ? null : Arrays.asList(flags); + return this; + } + + /** + * Set the flags property: Regular expression flags. + * + * @param flags the flags value to set. + * @return the PatternAnalyzer object itself. + */ + @JsonSetter public PatternAnalyzer setFlags(List flags) { this.flags = flags; return this; @@ -135,6 +149,18 @@ public List getStopwords() { * @param stopwords the stopwords value to set. * @return the PatternAnalyzer object itself. */ + public PatternAnalyzer setStopwords(String... stopwords) { + this.stopwords = (stopwords == null) ? null : Arrays.asList(stopwords); + return this; + } + + /** + * Set the stopwords property: A list of stopwords. + * + * @param stopwords the stopwords value to set. + * @return the PatternAnalyzer object itself. + */ + @JsonSetter public PatternAnalyzer setStopwords(List stopwords) { this.stopwords = stopwords; return this; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/PatternTokenizer.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/PatternTokenizer.java index 3b685f78a23f..03f3842f9a37 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/PatternTokenizer.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/PatternTokenizer.java @@ -5,9 +5,11 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.Arrays; import java.util.List; /** @@ -90,6 +92,18 @@ public List getFlags() { * @param flags the flags value to set. * @return the PatternTokenizer object itself. */ + public PatternTokenizer setFlags(RegexFlags... flags) { + this.flags = (flags == null) ? null : Arrays.asList(flags); + return this; + } + + /** + * Set the flags property: Regular expression flags. + * + * @param flags the flags value to set. + * @return the PatternTokenizer object itself. + */ + @JsonSetter public PatternTokenizer setFlags(List flags) { this.flags = flags; return this; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/ScoringProfile.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/ScoringProfile.java index 750a97cfcb90..c07e1aee0718 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/ScoringProfile.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/ScoringProfile.java @@ -6,6 +6,9 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; + +import java.util.Arrays; import java.util.List; /** @@ -100,6 +103,19 @@ public List getFunctions() { * @param functions the functions value to set. * @return the ScoringProfile object itself. */ + public ScoringProfile setFunctions(ScoringFunction... functions) { + this.functions = (functions == null) ? null : Arrays.asList(functions); + return this; + } + + /** + * Set the functions property: The collection of functions that influence + * the scoring of documents. + * + * @param functions the functions value to set. + * @return the ScoringProfile object itself. + */ + @JsonSetter public ScoringProfile setFunctions(List functions) { this.functions = functions; return this; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchField.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchField.java index 130aaef4938b..64b5d61ce0e0 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchField.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchField.java @@ -7,6 +7,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; + +import java.util.Arrays; import java.util.List; /** @@ -683,6 +686,24 @@ public List getSynonymMapNames() { * @param synonymMapNames the synonymMap names to set. * @return the SearchField object itself. */ + public SearchField setSynonymMapNames(String... synonymMapNames) { + this.synonymMapNames = (synonymMapNames == null) ? null : Arrays.asList(synonymMapNames); + return this; + } + + /** + * Set the synonymMaps property: A list of the names of synonym maps to + * associate with this field. This option can be used only with searchable + * fields. Currently only one synonym map per field is supported. Assigning + * a synonym map to a field ensures that query terms targeting that field + * are expanded at query-time using the rules in the synonym map. This + * attribute can be changed on existing fields. Must be null or an empty + * collection for complex fields. + * + * @param synonymMapNames the synonymMap names to set. + * @return the SearchField object itself. + */ + @JsonSetter public SearchField setSynonymMapNames(List synonymMapNames) { this.synonymMapNames = synonymMapNames; return this; @@ -707,6 +728,20 @@ public List getFields() { * @param fields the fields value to set. * @return the SearchField object itself. */ + public SearchField setFields(SearchField... fields) { + this.fields = (fields == null) ? null : Arrays.asList(fields); + return this; + } + + /** + * Set the fields property: A list of sub-fields if this is a field of type + * Edm.ComplexType or Collection(Edm.ComplexType). Must be null or empty + * for simple fields. + * + * @param fields the fields value to set. + * @return the SearchField object itself. + */ + @JsonSetter public SearchField setFields(List fields) { this.fields = fields; return this; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchFieldBase.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchFieldBase.java deleted file mode 100644 index 9c86b3c628e3..000000000000 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchFieldBase.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.search.documents.indexes.models; - -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; - -import java.util.Objects; - -/** - * Base field type for helper classes to more easily create a {@link SearchIndex}. - */ -public abstract class SearchFieldBase { - private final ClientLogger logger = new ClientLogger(SearchFieldBase.class); - private final String name; - private final SearchFieldDataType dataType; - - /** - * Initializes a new instance of the {@link SearchFieldBase} class. - * @param name The name of the field, which must be unique within the index or parent field. - * @param dataType The data type of the field. - */ - protected SearchFieldBase(String name, SearchFieldDataType dataType) { - if (CoreUtils.isNullOrEmpty(name)) { - throw logger.logExceptionAsError(new IllegalArgumentException("The name of the field cannot be null")); - } - this.dataType = Objects.requireNonNull(dataType, "'dataType' cannot be null."); - this.name = name; - } - - /** - * Get the name of the field. - * - * @return The name of the field. - */ - public String getName() { - return name; - } - - /** - * Get the {@link SearchFieldDataType} of the field. - * - * @return The data type of the field. - */ - public SearchFieldDataType getDataType() { - return dataType; - } -} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndex.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndex.java index 769a2d677412..6d20056eb043 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndex.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndex.java @@ -6,6 +6,9 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; + +import java.util.Arrays; import java.util.List; /** @@ -152,6 +155,18 @@ public List getFields() { * @param fields the fields value to set. * @return the SearchIndex object itself. */ + public SearchIndex setFields(SearchField... fields) { + this.fields = (fields == null) ? null : Arrays.asList(fields); + return this; + } + + /** + * Set the fields property: The fields of the index. + * + * @param fields the fields value to set. + * @return the SearchIndex object itself. + */ + @JsonSetter public SearchIndex setFields(List fields) { this.fields = fields; return this; @@ -172,6 +187,18 @@ public List getScoringProfiles() { * @param scoringProfiles the scoringProfiles value to set. * @return the SearchIndex object itself. */ + public SearchIndex setScoringProfiles(ScoringProfile... scoringProfiles) { + this.scoringProfiles = (scoringProfiles == null) ? null : Arrays.asList(scoringProfiles); + return this; + } + + /** + * Set the scoringProfiles property: The scoring profiles for the index. + * + * @param scoringProfiles the scoringProfiles value to set. + * @return the SearchIndex object itself. + */ + @JsonSetter public SearchIndex setScoringProfiles(List scoringProfiles) { this.scoringProfiles = scoringProfiles; return this; @@ -240,6 +267,18 @@ public List getSuggesters() { * @param suggesters the suggesters value to set. * @return the SearchIndex object itself. */ + public SearchIndex setSuggesters(SearchSuggester... suggesters) { + this.suggesters = (suggesters == null) ? null : Arrays.asList(suggesters); + return this; + } + + /** + * Set the suggesters property: The suggesters for the index. + * + * @param suggesters the suggesters value to set. + * @return the SearchIndex object itself. + */ + @JsonSetter public SearchIndex setSuggesters(List suggesters) { this.suggesters = suggesters; return this; @@ -260,6 +299,18 @@ public List getAnalyzers() { * @param analyzers the analyzers value to set. * @return the SearchIndex object itself. */ + public SearchIndex setAnalyzers(LexicalAnalyzer... analyzers) { + this.analyzers = (analyzers == null) ? null : Arrays.asList(analyzers); + return this; + } + + /** + * Set the analyzers property: The analyzers for the index. + * + * @param analyzers the analyzers value to set. + * @return the SearchIndex object itself. + */ + @JsonSetter public SearchIndex setAnalyzers(List analyzers) { this.analyzers = analyzers; return this; @@ -280,6 +331,18 @@ public List getTokenizers() { * @param tokenizers the tokenizers value to set. * @return the SearchIndex object itself. */ + public SearchIndex setTokenizers(LexicalTokenizer... tokenizers) { + this.tokenizers = (tokenizers == null) ? null : Arrays.asList(tokenizers); + return this; + } + + /** + * Set the tokenizers property: The tokenizers for the index. + * + * @param tokenizers the tokenizers value to set. + * @return the SearchIndex object itself. + */ + @JsonSetter public SearchIndex setTokenizers(List tokenizers) { this.tokenizers = tokenizers; return this; @@ -300,6 +363,18 @@ public List getTokenFilters() { * @param tokenFilters the tokenFilters value to set. * @return the SearchIndex object itself. */ + public SearchIndex setTokenFilters(TokenFilter... tokenFilters) { + this.tokenFilters = (tokenFilters == null) ? null : Arrays.asList(tokenFilters); + return this; + } + + /** + * Set the tokenFilters property: The token filters for the index. + * + * @param tokenFilters the tokenFilters value to set. + * @return the SearchIndex object itself. + */ + @JsonSetter public SearchIndex setTokenFilters(List tokenFilters) { this.tokenFilters = tokenFilters; return this; @@ -320,6 +395,18 @@ public List getCharFilters() { * @param charFilters the charFilters value to set. * @return the SearchIndex object itself. */ + public SearchIndex setCharFilters(CharFilter... charFilters) { + this.charFilters = (charFilters == null) ? null : Arrays.asList(charFilters); + return this; + } + + /** + * Set the charFilters property: The character filters for the index. + * + * @param charFilters the charFilters value to set. + * @return the SearchIndex object itself. + */ + @JsonSetter public SearchIndex setCharFilters(List charFilters) { this.charFilters = charFilters; return this; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexer.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexer.java index 58d0fc9e5fc9..9a46b807fb4e 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexer.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexer.java @@ -6,6 +6,9 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; + +import java.util.Arrays; import java.util.List; /** @@ -259,6 +262,19 @@ public List getFieldMappings() { * @param fieldMappings the fieldMappings value to set. * @return the SearchIndexer object itself. */ + public SearchIndexer setFieldMappings(FieldMapping... fieldMappings) { + this.fieldMappings = (fieldMappings == null) ? null : Arrays.asList(fieldMappings); + return this; + } + + /** + * Set the fieldMappings property: Defines mappings between fields in the + * data source and corresponding target fields in the index. + * + * @param fieldMappings the fieldMappings value to set. + * @return the SearchIndexer object itself. + */ + @JsonSetter public SearchIndexer setFieldMappings(List fieldMappings) { this.fieldMappings = fieldMappings; return this; @@ -281,6 +297,19 @@ public List getOutputFieldMappings() { * @param outputFieldMappings the outputFieldMappings value to set. * @return the SearchIndexer object itself. */ + public SearchIndexer setOutputFieldMappings(FieldMapping... outputFieldMappings) { + this.outputFieldMappings = (outputFieldMappings == null) ? null : Arrays.asList(outputFieldMappings); + return this; + } + + /** + * Set the outputFieldMappings property: Output field mappings are applied + * after enrichment and immediately before indexing. + * + * @param outputFieldMappings the outputFieldMappings value to set. + * @return the SearchIndexer object itself. + */ + @JsonSetter public SearchIndexer setOutputFieldMappings(List outputFieldMappings) { this.outputFieldMappings = outputFieldMappings; return this; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexerSkillset.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexerSkillset.java index 6283f51f1943..ed5144112736 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexerSkillset.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndexerSkillset.java @@ -6,6 +6,9 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; + +import java.util.Arrays; import java.util.List; /** @@ -110,6 +113,18 @@ public List getSkills() { * @param skills the skills value to set. * @return the SearchIndexerSkillset object itself. */ + public SearchIndexerSkillset setSkills(SearchIndexerSkill... skills) { + this.skills = (skills == null) ? null : Arrays.asList(skills); + return this; + } + + /** + * Set the skills property: A list of skills in the skillset. + * + * @param skills the skills value to set. + * @return the SearchIndexerSkillset object itself. + */ + @JsonSetter public SearchIndexerSkillset setSkills(List skills) { this.skills = skills; return this; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchableFieldBuilder.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchableFieldBuilder.java deleted file mode 100644 index 06426b799749..000000000000 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchableFieldBuilder.java +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.search.documents.indexes.models; - -import java.util.List; - -/** - * A helper Field model to build a searchable {@link SearchField}. - */ -public class SearchableFieldBuilder extends SimpleFieldBuilder { - private LexicalAnalyzerName analyzerName; - private LexicalAnalyzerName searchAnalyzerName; - private LexicalAnalyzerName indexAnalyzerName; - private List synonymMapNames; - - /** - * Initializes a new instance of the {@link SearchableFieldBuilder} class. - * - * @param name The name of the field, which must be unique within the index or parent field. - * @param collection Whether the field is a collection of strings. - * @throws NullPointerException when {@code name} is null. - */ - public SearchableFieldBuilder(String name, boolean collection) { - super(name, SearchFieldDataType.STRING, collection); - } - - /** - * Gets the name of the language analyzer. This property cannot be set when either {@code searchAnalyzer} or - * {@code indexAnalyzer} are set. Once the analyzer is chosen, it cannot be changed for the field in the index. - * - * @return The {@link LexicalAnalyzerName} used for analyzer. - */ - public LexicalAnalyzerName getAnalyzerName() { - return analyzerName; - } - - /** - * Sets the name of the language analyzer. This property cannot be set when either {@code searchAnalyzer} or - * {@code indexAnalyzer} are set. Once the analyzer is chosen, it cannot be changed for the field in the index. - * - * @param analyzerName The {@link LexicalAnalyzerName} used for analyzer. - * @return The SearchableFieldBuilder object itself. - */ - public SearchableFieldBuilder setAnalyzerName(LexicalAnalyzerName analyzerName) { - this.analyzerName = analyzerName; - return this; - } - - /** - * Gets the name of the language analyzer for searching. This property must be set together with - * {@code indexAnalyzer}, and cannot be set when {@code analyzer} is set. Once the analyzer is chosen, it cannot be - * changed for the field in the index. - * - * @return The {@link LexicalAnalyzerName} used for search analyzer. - */ - public LexicalAnalyzerName getSearchAnalyzerName() { - return searchAnalyzerName; - } - - /** - * Sets the name of the language analyzer for searching. This property must be set together with - * {@code indexAnalyzer}, and cannot be set when {@code analyzer} is set. Once the analyzer is chosen, it cannot be - * changed for the field in the index. - * - * @param searchAnalyzerName The {@link LexicalAnalyzerName} used for search analyzer. - * @return The SearchableField object itself. - */ - public SearchableFieldBuilder setSearchAnalyzerName(LexicalAnalyzerName searchAnalyzerName) { - this.searchAnalyzerName = searchAnalyzerName; - return this; - } - - /** - * Gets the name of the language analyzer for indexing. This property must be set together with - * {@code searchAnalyzer}, and cannot be set when {@code analyzer} is set. Once the analyzer is chosen, it cannot be - * changed for the field in the index. - * - * @return The {@link LexicalAnalyzerName} used for index analyzer. - */ - public LexicalAnalyzerName getIndexAnalyzerName() { - return indexAnalyzerName; - } - - /** - * Gets the name of the language analyzer for indexing. This property must be set together with - * {@code searchAnalyzer}, and cannot be set when {@code analyzer} is set. Once the analyzer is chosen, it cannot be - * changed for the field in the index. - * - * @param indexAnalyzerName The {@link LexicalAnalyzerName} used for index analyzer. - * @return The SearchableField object itself. - */ - public SearchableFieldBuilder setIndexAnalyzerName(LexicalAnalyzerName indexAnalyzerName) { - this.indexAnalyzerName = indexAnalyzerName; - return this; - } - - /** - * Gets a list of names of synonym maps to associate with this field. - * Currently, only one synonym map per field is supported. - * - * Assigning a synonym map to a field ensures that query terms targeting that field are expanded at query-time using - * the rules in the synonym map. This attribute can be changed on existing fields. - * - * @return List of names of synonym maps to associate with this field. - */ - public List getSynonymMapNames() { - return synonymMapNames; - } - - /** - * Sets a list of names of synonym maps to associate with this field. - * Currently, only one synonym map per field is supported. - * - * Assigning a synonym map to a field ensures that query terms targeting that field are expanded at query-time using - * the rules in the synonym map. This attribute can be changed on existing fields. - * - * @param synonymMapNames list of names of synonym maps to associate with this field. - * @return The SearchableField object itself. - */ - public SearchableFieldBuilder setSynonymMapNames(List synonymMapNames) { - this.synonymMapNames = synonymMapNames; - return this; - } - - /** - * Convert SearchableField to {@link SearchField}. - * - * @return The {@link SearchField} object. - */ - public SearchField build() { - return new SearchField(super.getName(), super.getDataType()) - .setSearchable(true) - .setKey(super.isKey()) - .setSortable(super.isSortable()) - .setFilterable(super.isFilterable()) - .setHidden(super.isHidden()) - .setFacetable(super.isFacetable()) - .setAnalyzerName(this.analyzerName) - .setSearchAnalyzerName(this.searchAnalyzerName) - .setIndexAnalyzerName(this.indexAnalyzerName) - .setSynonymMapNames(this.synonymMapNames); - } -} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SimpleFieldBuilder.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SimpleFieldBuilder.java deleted file mode 100644 index 905335b57b7c..000000000000 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SimpleFieldBuilder.java +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.search.documents.indexes.models; - -/** - * A helper Field model to build a simple {@link SearchField}. - */ -public class SimpleFieldBuilder extends SearchFieldBase { - private boolean key; - private boolean facetable; - private boolean sortable; - private boolean filterable; - private boolean hidden; - - /** - * Initializes a new instance of the {@link SimpleFieldBuilder} class. - * - * @param name The name of the field, which must be unique within the index or parent field. - * @param dataType The {@link SearchFieldDataType} of the {@link SearchField}. - * @param collection boolean field to indicate whether the dataType is collection. - * @throws NullPointerException when {@code name} is null. - */ - public SimpleFieldBuilder(String name, SearchFieldDataType dataType, boolean collection) { - super(name, collection ? SearchFieldDataType.collection(dataType) : dataType); - } - - /** - * Gets whether the field is the key field. - * - * @return An {@link SearchIndex} must have exactly one key field of type {@code DataType.EDM_STRING}. - */ - public boolean isKey() { - return key; - } - - /** - * Sets whether the field is the key field. The default is false. - * - * @param key boolean to indicate whether the field is key field or not. - * @return The SimpleField object itself. - */ - public SimpleFieldBuilder setKey(boolean key) { - this.key = key; - return this; - } - - /** - * Gets a value indicating whether to enable the field can be referenced in {@code $orderby} expressions. - * By default Azure Cognitive Search sorts results by score, but in many experiences users may want to sort by - * fields in the documents. - * - * @return The boolean to indicate whether the field is sortable or not. - */ - public boolean isSortable() { - return sortable; - } - - /** - * Sets a value indicating whether to enable the field can be referenced in {@code $orderby} expressions. - * The default is false. - * By default Azure Cognitive Search sorts results by score, but in many experiences users may want to sort by - * fields in the documents. - * - * @param sortable The boolean to indicate whether the field is sortable or not. - * @return The SimpleField object itself. - */ - public SimpleFieldBuilder setSortable(boolean sortable) { - this.sortable = sortable; - return this; - } - - /** - * Gets or sets a value indicating whether the field can be referenced in {@code $filter} queries. - * - * @return The boolean to indicate whether the field is filterable or not. - */ - public boolean isFilterable() { - return filterable; - } - - /** - * Gets or sets a value indicating whether the field can be referenced in {@code $filter} queries. - * The default is false. - * - * @param filterable The boolean to indicate whether the field is filterable or not. - * @return The SimpleField object itself. - */ - public SimpleFieldBuilder setFilterable(boolean filterable) { - this.filterable = filterable; - return this; - } - - /** - * Gets whether the field is returned in search results. - * - * @return The boolean to indicate whether the field is hidden or not. - */ - public boolean isHidden() { - return hidden; - } - - /** - * Sets whether the field is returned in search results. The default is false. - * A key field where {@code key} is true must have this property set to false. - * - * @param hidden The boolean to indicate whether the field is hidden or not. - * @return The SimpleField object itself. - */ - public SimpleFieldBuilder setHidden(boolean hidden) { - this.hidden = hidden; - return this; - } - - /** - * Gets a value indicating whether the field can be retrieved in facet queries. - * Facets are used in presentation of search results that include hit counts by categories. - * For example, in a search for digital cameras, facets might include branch, megapixels, price, etc. - * - * @return The boolean to indicate whether the field is facetable or not. - */ - public boolean isFacetable() { - return facetable; - } - - /** - * Sets a value indicating whether the field can be retrieved in facet queries. The default is false. - * Facets are used in presentation of search results that include hit counts by categories. - * For example, in a search for digital cameras, facets might include branch, megapixels, price, etc. - * - * @param facetable The boolean to indicate whether the field is facetable or not. - * @return The SimpleField object itself. - */ - public SimpleFieldBuilder setFacetable(boolean facetable) { - this.facetable = facetable; - return this; - } - - /** - * Convert SimpleField to {@link SearchField}. - * - * @return The {@link SearchField} object. - */ - public SearchField build() { - return new SearchField(super.getName(), super.getDataType()) - .setKey(key) - .setSearchable(false) - .setSortable(sortable) - .setFilterable(filterable) - .setHidden(hidden) - .setFacetable(facetable) - .setHidden(hidden); - } -} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/StopAnalyzer.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/StopAnalyzer.java index 98d10d80a5ed..34cd38efd123 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/StopAnalyzer.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/StopAnalyzer.java @@ -5,8 +5,11 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; + +import java.util.Arrays; import java.util.List; /** @@ -49,6 +52,18 @@ public List getStopwords() { * @param stopwords the stopwords value to set. * @return the StopAnalyzer object itself. */ + public StopAnalyzer setStopwords(String... stopwords) { + this.stopwords = (stopwords == null) ? null : Arrays.asList(stopwords); + return this; + } + + /** + * Set the stopwords property: A list of stopwords. + * + * @param stopwords the stopwords value to set. + * @return the StopAnalyzer object itself. + */ + @JsonSetter public StopAnalyzer setStopwords(List stopwords) { this.stopwords = stopwords; return this; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/StopwordsTokenFilter.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/StopwordsTokenFilter.java index 4cddb34d8d5e..d7179cd3706a 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/StopwordsTokenFilter.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/StopwordsTokenFilter.java @@ -5,8 +5,11 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; + +import java.util.Arrays; import java.util.List; /** @@ -78,6 +81,19 @@ public List getStopwords() { * @param stopwords the stopwords value to set. * @return the StopwordsTokenFilter object itself. */ + public StopwordsTokenFilter setStopwords(String... stopwords) { + this.stopwords = (stopwords == null) ? null : Arrays.asList(stopwords); + return this; + } + + /** + * Set the stopwords property: The list of stopwords. This property and the + * stopwords list property cannot both be set. + * + * @param stopwords the stopwords value to set. + * @return the StopwordsTokenFilter object itself. + */ + @JsonSetter public StopwordsTokenFilter setStopwords(List stopwords) { this.stopwords = stopwords; return this; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/WordDelimiterTokenFilter.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/WordDelimiterTokenFilter.java index 99a66624dd1f..aed639ef9c55 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/WordDelimiterTokenFilter.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/WordDelimiterTokenFilter.java @@ -5,8 +5,11 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; + +import java.util.Arrays; import java.util.List; /** @@ -329,6 +332,19 @@ public List getProtectedWords() { * @param protectedWords the protectedWords value to set. * @return the WordDelimiterTokenFilter object itself. */ + public WordDelimiterTokenFilter setProtectedWords(String... protectedWords) { + this.protectedWords = (protectedWords == null) ? null : Arrays.asList(protectedWords); + return this; + } + + /** + * Set the protectedWords property: A list of tokens to protect from being + * delimited. + * + * @param protectedWords the protectedWords value to set. + * @return the WordDelimiterTokenFilter object itself. + */ + @JsonSetter public WordDelimiterTokenFilter setProtectedWords(List protectedWords) { this.protectedWords = protectedWords; return this; diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/AutocompleteOptions.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/AutocompleteOptions.java index 37bf316d380b..482d69a7c1d0 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/AutocompleteOptions.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/AutocompleteOptions.java @@ -254,7 +254,7 @@ public List getSearchFields() { * @return the AutocompleteOptions object itself. */ public AutocompleteOptions setSearchFields(String... searchFields) { - this.searchFields = Arrays.asList(searchFields); + this.searchFields = (searchFields == null) ? null : Arrays.asList(searchFields); return this; } diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/SearchOptions.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/SearchOptions.java index 8066adabd829..196505ee8d10 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/SearchOptions.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/SearchOptions.java @@ -193,7 +193,7 @@ public List getFacets() { * @return the SearchOptions object itself. */ public SearchOptions setFacets(String... facets) { - this.facets = Arrays.asList(facets); + this.facets = (facets == null) ? null : Arrays.asList(facets); return this; } @@ -237,7 +237,7 @@ public List getHighlightFields() { * @return the SearchOptions object itself. */ public SearchOptions setHighlightFields(String... highlightFields) { - this.highlightFields = Arrays.asList(highlightFields); + this.highlightFields = (highlightFields == null) ? null : Arrays.asList(highlightFields); return this; } @@ -347,7 +347,7 @@ public List getOrderBy() { * @return the SearchOptions object itself. */ public SearchOptions setOrderBy(String... orderBy) { - this.orderBy = Arrays.asList(orderBy); + this.orderBy = (orderBy == null) ? null : Arrays.asList(orderBy); return this; } @@ -399,7 +399,7 @@ public List getScoringParameters() { * @return the SearchOptions object itself. */ public SearchOptions setScoringParameters(ScoringParameter... scoringParameters) { - this.scoringParameters = Arrays.asList(scoringParameters); + this.scoringParameters = (scoringParameters == null) ? null : Arrays.asList(scoringParameters); return this; } @@ -451,7 +451,7 @@ public List getSearchFields() { * @return the SearchOptions object itself. */ public SearchOptions setSearchFields(String... searchFields) { - this.searchFields = Arrays.asList(searchFields); + this.searchFields = (searchFields == null) ? null : Arrays.asList(searchFields); return this; } @@ -497,7 +497,7 @@ public List getSelect() { * @return the SearchOptions object itself. */ public SearchOptions setSelect(String... select) { - this.select = Arrays.asList(select); + this.select = (select == null) ? null : Arrays.asList(select); return this; } diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/SuggestOptions.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/SuggestOptions.java index 4707580e2eb7..7268718ed886 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/SuggestOptions.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/models/SuggestOptions.java @@ -248,7 +248,7 @@ public List getOrderBy() { * @return the SuggestOptions object itself. */ public SuggestOptions setOrderBy(String... orderBy) { - this.orderBy = Arrays.asList(orderBy); + this.orderBy = (orderBy == null) ? null : Arrays.asList(orderBy); return this; } @@ -272,7 +272,7 @@ public List getSearchFields() { * @return the SuggestOptions object itself. */ public SuggestOptions setSearchFields(String... searchFields) { - this.searchFields = Arrays.asList(searchFields); + this.searchFields = (searchFields == null) ? null : Arrays.asList(searchFields); return this; } @@ -294,7 +294,7 @@ public List getSelect() { * @return the SuggestOptions object itself. */ public SuggestOptions setSelect(String... select) { - this.select = Arrays.asList(select); + this.select = (select == null) ? null : Arrays.asList(select); return this; } diff --git a/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/IndexAndServiceStatisticsExample.java b/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/IndexAndServiceStatisticsExample.java index 3decd86005df..186cd8260634 100644 --- a/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/IndexAndServiceStatisticsExample.java +++ b/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/IndexAndServiceStatisticsExample.java @@ -42,8 +42,8 @@ public class IndexAndServiceStatisticsExample { /** - * From the Azure portal, get your Azure Cognitive Search service name and API key and - * populate ADMIN_KEY and SEARCH_SERVICE_NAME. + * From the Azure portal, get your Azure Cognitive Search service name and API key and populate ADMIN_KEY and + * SEARCH_SERVICE_NAME. */ private static final String ENDPOINT = Configuration.getGlobalConfiguration().get("AZURE_COGNITIVE_SEARCH_ENDPOINT"); private static final String ADMIN_KEY = Configuration.getGlobalConfiguration().get("AZURE_COGNITIVE_SEARCH_ADMIN_KEY"); @@ -286,8 +286,7 @@ private static SearchIndex createTestIndex() { .setScoringProfiles(Arrays.asList( new ScoringProfile("MyProfile") .setFunctionAggregation(ScoringFunctionAggregation.AVERAGE) - .setFunctions(Arrays.asList( - new MagnitudeScoringFunction("Rating", 2.0, + .setFunctions(new MagnitudeScoringFunction("Rating", 2.0, new MagnitudeScoringParameters(1, 4) .setShouldBoostBeyondRangeByConstant(true)) .setInterpolation(ScoringFunctionInterpolation.CONSTANT), @@ -297,36 +296,30 @@ private static SearchIndex createTestIndex() { new FreshnessScoringFunction("LastRenovationDate", 1.1, new FreshnessScoringParameters(Duration.ofDays(365))) .setInterpolation(ScoringFunctionInterpolation.LOGARITHMIC) - )) + ) .setTextWeights(new TextWeights(weights)), new ScoringProfile("ProfileTwo") .setFunctionAggregation(ScoringFunctionAggregation.MAXIMUM) - .setFunctions(Collections.singletonList( - new TagScoringFunction("Tags", 1.5, new TagScoringParameters("MyTags")) - .setInterpolation(ScoringFunctionInterpolation.LINEAR) - )), + .setFunctions(new TagScoringFunction("Tags", 1.5, new TagScoringParameters("MyTags")) + .setInterpolation(ScoringFunctionInterpolation.LINEAR) + ), new ScoringProfile("ProfileThree") .setFunctionAggregation(ScoringFunctionAggregation.MINIMUM) - .setFunctions(Collections.singletonList( - new MagnitudeScoringFunction("Rating", 3.0, - new MagnitudeScoringParameters(0, 10) + .setFunctions(new MagnitudeScoringFunction("Rating", 3.0, + new MagnitudeScoringParameters(0, 10) .setShouldBoostBeyondRangeByConstant(false)) - .setInterpolation(ScoringFunctionInterpolation.QUADRATIC) - )), + .setInterpolation(ScoringFunctionInterpolation.QUADRATIC) + ), new ScoringProfile("ProfileFour") .setFunctionAggregation(ScoringFunctionAggregation.FIRST_MATCHING) - .setFunctions(Collections.singletonList( - new MagnitudeScoringFunction("Rating", 3.14, - new MagnitudeScoringParameters(1, 5) + .setFunctions(new MagnitudeScoringFunction("Rating", 3.14, + new MagnitudeScoringParameters(1, 5) .setShouldBoostBeyondRangeByConstant(false)) - .setInterpolation(ScoringFunctionInterpolation.CONSTANT) - )) - )) + .setInterpolation(ScoringFunctionInterpolation.CONSTANT)))) .setDefaultScoringProfile("MyProfile") .setCorsOptions(new CorsOptions(Arrays.asList("http://tempuri.org", "http://localhost:80")) .setMaxAgeInSeconds(60L)) - .setSuggesters(Collections.singletonList(new SearchSuggester("FancySuggester", - Collections.singletonList("HotelName")))); + .setSuggesters(new SearchSuggester("FancySuggester", Collections.singletonList("HotelName"))); } /** diff --git a/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/IndexContentManagementExample.java b/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/IndexContentManagementExample.java index f8d8a9983c71..fc537ac0fd8e 100644 --- a/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/IndexContentManagementExample.java +++ b/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/IndexContentManagementExample.java @@ -10,6 +10,7 @@ import com.azure.search.documents.models.IndexDocumentsResult; import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -66,8 +67,8 @@ private static void advancedIndexing() { .buildClient(); IndexDocumentsBatch batch = new IndexDocumentsBatch() - .addMergeOrUploadActions(new Hotel().setHotelId("100")) - .addDeleteActions(new Hotel().setHotelId("200")); + .addMergeOrUploadActions(Collections.singletonList(new Hotel().setHotelId("100"))) + .addDeleteActions(Collections.singletonList(new Hotel().setHotelId("200"))); // Send a single batch that performs many different actions IndexDocumentsResult result = client.indexDocuments(batch); diff --git a/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/ReadmeSamples.java b/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/ReadmeSamples.java index 3d684fd1ae87..a817585285d5 100644 --- a/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/ReadmeSamples.java +++ b/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/ReadmeSamples.java @@ -14,15 +14,12 @@ 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.ComplexFieldBuilder; import com.azure.search.documents.indexes.models.IndexDocumentsBatch; import com.azure.search.documents.indexes.models.LexicalAnalyzerName; import com.azure.search.documents.indexes.models.SearchField; import com.azure.search.documents.indexes.models.SearchFieldDataType; import com.azure.search.documents.indexes.models.SearchIndex; import com.azure.search.documents.indexes.models.SearchSuggester; -import com.azure.search.documents.indexes.models.SearchableFieldBuilder; -import com.azure.search.documents.indexes.models.SimpleFieldBuilder; import com.azure.search.documents.models.SearchOptions; import com.azure.search.documents.models.SearchResult; import com.azure.search.documents.util.SearchPagedIterable; @@ -215,56 +212,55 @@ public void retrieveDocuments() { public void batchDocumentsOperations() { IndexDocumentsBatch batch = new IndexDocumentsBatch(); - batch.addUploadActions(new Hotel().setId("783").setName("Upload Inn")); - batch.addMergeActions(new Hotel().setId("12").setName("Renovated Ranch")); + batch.addUploadActions(Collections.singletonList(new Hotel().setId("783").setName("Upload Inn"))); + batch.addMergeActions(Collections.singletonList(new Hotel().setId("12").setName("Renovated Ranch"))); searchClient.indexDocuments(batch); } public void createIndex() { - // Prepare SearchFields with SimpleFieldBuilder, SearchableFieldBuilder and ComplexFieldBuilder. List searchFieldList = new ArrayList<>(); - searchFieldList.add(new SimpleFieldBuilder("hotelId", SearchFieldDataType.STRING, false) + searchFieldList.add(new SearchField("hotelId", SearchFieldDataType.STRING) .setKey(true) .setFilterable(true) - .setSortable(true) - .build()); - searchFieldList.add(new SearchableFieldBuilder("hotelName", false) + .setSortable(true)); + + searchFieldList.add(new SearchField("hotelName", SearchFieldDataType.STRING) + .setSearchable(true) .setFilterable(true) - .setSortable(true) - .build()); - searchFieldList.add(new SearchableFieldBuilder("description", false) - .setAnalyzerName(LexicalAnalyzerName.EU_LUCENE) - .build()); - searchFieldList.add(new SearchableFieldBuilder("tags", true) + .setSortable(true)); + searchFieldList.add(new SearchField("description", SearchFieldDataType.STRING) + .setSearchable(true) + .setAnalyzerName(LexicalAnalyzerName.EU_LUCENE)); + searchFieldList.add(new SearchField("tags", SearchFieldDataType.collection(SearchFieldDataType.STRING)) + .setSearchable(true) .setKey(true) .setFilterable(true) - .setFacetable(true) - .build()); - searchFieldList.add(new ComplexFieldBuilder("address", false) + .setFacetable(true)); + searchFieldList.add(new SearchField("address", SearchFieldDataType.COMPLEX) .setFields(Arrays.asList( - new SearchableFieldBuilder("streetAddress", false).build(), - new SearchableFieldBuilder("city", false) + new SearchField("streetAddress", SearchFieldDataType.STRING).setSearchable(true), + new SearchField("city", SearchFieldDataType.STRING) + .setSearchable(true) .setFilterable(true) .setFacetable(true) - .setSortable(true) - .build(), - new SearchableFieldBuilder("stateProvince", false) + .setSortable(true), + new SearchField("stateProvince", SearchFieldDataType.STRING) + .setSearchable(true) .setFilterable(true) .setFacetable(true) - .setSortable(true) - .build(), - new SearchableFieldBuilder("country", false) + .setSortable(true), + new SearchField("country", SearchFieldDataType.STRING) + .setSearchable(true) .setFilterable(true) .setFacetable(true) - .setSortable(true) - .build(), - new SearchableFieldBuilder("postalCode", false) + .setSortable(true), + new SearchField("postalCode", SearchFieldDataType.STRING) + .setSearchable(true) .setFilterable(true) .setFacetable(true) .setSortable(true) - .build() - )) - .build()); + ))); + // Prepare suggester. SearchSuggester suggester = new SearchSuggester("sg", Collections.singletonList("hotelName")); // Prepare SearchIndex with index name and search fields. diff --git a/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/RefineSearchCapabilitiesExample.java b/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/RefineSearchCapabilitiesExample.java index 2c1ccc0ab7be..88ce4b28826b 100644 --- a/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/RefineSearchCapabilitiesExample.java +++ b/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/RefineSearchCapabilitiesExample.java @@ -129,7 +129,7 @@ private static void addSynonymMapToIndex(SearchIndexClient client) { SearchIndex index = client.getIndex(INDEX_NAME); List fields = index.getFields(); - fields.get(1).setSynonymMapNames(Collections.singletonList(synonymMapName)); + fields.get(1).setSynonymMapNames(synonymMapName); index.setFields(fields); client.createOrUpdateIndex(index); 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 62c6b34a4ab3..a99366c3e06f 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 @@ -33,8 +33,6 @@ import com.azure.search.documents.indexes.models.SearchIndexerStatus; import com.azure.search.documents.indexes.models.SearchServiceStatistics; import com.azure.search.documents.indexes.models.SearchSuggester; -import com.azure.search.documents.indexes.models.SearchableFieldBuilder; -import com.azure.search.documents.indexes.models.SimpleFieldBuilder; import com.azure.search.documents.indexes.models.SynonymMap; import com.azure.search.documents.models.AutocompleteItem; import com.azure.search.documents.models.AutocompleteMode; @@ -220,8 +218,8 @@ public void indexDocuments() { searchDocument2.put("hotelId", "2"); searchDocument2.put("hotelName", "test2"); IndexDocumentsBatch indexDocumentsBatch = new IndexDocumentsBatch<>(); - indexDocumentsBatch.addUploadActions(searchDocument1); - indexDocumentsBatch.addDeleteActions(searchDocument2); + indexDocumentsBatch.addUploadActions(Collections.singletonList(searchDocument1)); + indexDocumentsBatch.addDeleteActions(Collections.singletonList(searchDocument2)); IndexDocumentsResult result = searchClient.indexDocuments(indexDocumentsBatch); for (IndexingResult indexingResult : result.getResults()) { System.out.printf("Does document with key %s finish successfully? %b%n", indexingResult.getKey(), @@ -242,8 +240,8 @@ public void indexDocumentsWithResponse() { searchDocument2.put("hotelId", "2"); searchDocument2.put("hotelName", "test2"); IndexDocumentsBatch indexDocumentsBatch = new IndexDocumentsBatch<>(); - indexDocumentsBatch.addUploadActions(searchDocument1); - indexDocumentsBatch.addDeleteActions(searchDocument2); + indexDocumentsBatch.addUploadActions(Collections.singletonList(searchDocument1)); + indexDocumentsBatch.addDeleteActions(Collections.singletonList(searchDocument2)); Response resultResponse = searchClient.indexDocumentsWithResponse(indexDocumentsBatch, null, new Context(key1, value1)); System.out.println("The status code of the response is " + resultResponse.getStatusCode()); @@ -561,8 +559,8 @@ public void indexDocumentsAsync() { searchDocument2.put("hotelId", "2"); searchDocument2.put("hotelName", "test2"); IndexDocumentsBatch indexDocumentsBatch = new IndexDocumentsBatch<>(); - indexDocumentsBatch.addUploadActions(searchDocument1); - indexDocumentsBatch.addDeleteActions(searchDocument2); + indexDocumentsBatch.addUploadActions(Collections.singletonList(searchDocument1)); + indexDocumentsBatch.addDeleteActions(Collections.singletonList(searchDocument2)); searchAsyncClient.indexDocuments(indexDocumentsBatch) .subscribe(result -> { for (IndexingResult indexingResult : result.getResults()) { @@ -585,8 +583,8 @@ public void indexDocumentsWithResponseAsync() { searchDocument2.put("hotelId", "2"); searchDocument2.put("hotelName", "test2"); IndexDocumentsBatch indexDocumentsBatch = new IndexDocumentsBatch<>(); - indexDocumentsBatch.addUploadActions(searchDocument1); - indexDocumentsBatch.addDeleteActions(searchDocument2); + indexDocumentsBatch.addUploadActions(Collections.singletonList(searchDocument1)); + indexDocumentsBatch.addDeleteActions(Collections.singletonList(searchDocument2)); searchAsyncClient.indexDocumentsWithResponse(indexDocumentsBatch, null) .subscribe(resultResponse -> { System.out.println("The status code of the response is " + resultResponse.getStatusCode()); @@ -789,8 +787,8 @@ public void createSearchIndexClientFromBuilder() { public void createSearchIndex() { // BEGIN: com.azure.search.documents.indexes.SearchIndexClient.createIndex#SearchIndex List searchFields = Arrays.asList( - new SimpleFieldBuilder("hotelId", SearchFieldDataType.STRING, false).setKey(true).build(), - new SearchableFieldBuilder("hotelName", false).build() + new SearchField("hotelId", SearchFieldDataType.STRING).setKey(true), + new SearchField("hotelName", SearchFieldDataType.STRING).setSearchable(true) ); SearchIndex searchIndex = new SearchIndex("searchIndex", searchFields); SearchIndex indexFromService = searchIndexClient.createIndex(searchIndex); @@ -805,8 +803,8 @@ public void createSearchIndex() { public void createSearchIndexWithResponse() { // BEGIN: com.azure.search.documents.indexes.SearchIndexClient.createIndexWithResponse#SearchIndex-Context List searchFields = Arrays.asList( - new SimpleFieldBuilder("hotelId", SearchFieldDataType.STRING, false).setKey(true).build(), - new SearchableFieldBuilder("hotelName", false).build() + new SearchField("hotelId", SearchFieldDataType.STRING).setKey(true), + new SearchField("hotelName", SearchFieldDataType.STRING).setSearchable(true) ); SearchIndex searchIndex = new SearchIndex("searchIndex", searchFields); @@ -1199,8 +1197,8 @@ public void createSearchIndexAsyncClientFromBuilder() { public void createSearchIndexAsync() { // BEGIN: com.azure.search.documents.indexes.SearchIndexAsyncClient.createIndex#SearchIndex List searchFields = Arrays.asList( - new SimpleFieldBuilder("hotelId", SearchFieldDataType.STRING, false).setKey(true).build(), - new SearchableFieldBuilder("hotelName", false).build() + new SearchField("hotelId", SearchFieldDataType.STRING).setKey(true), + new SearchField("hotelName", SearchFieldDataType.STRING).setSearchable(true) ); SearchIndex searchIndex = new SearchIndex("searchIndex", searchFields); searchIndexAsyncClient.createIndex(searchIndex) @@ -1216,8 +1214,8 @@ public void createSearchIndexAsync() { public void createSearchIndexWithResponseAsync() { // BEGIN: com.azure.search.documents.indexes.SearchIndexAsyncClient.createIndexWithResponse#SearchIndex List searchFields = Arrays.asList( - new SimpleFieldBuilder("hotelId", SearchFieldDataType.STRING, false).setKey(true).build(), - new SearchableFieldBuilder("hotelName", false).build() + new SearchField("hotelId", SearchFieldDataType.STRING).setKey(true), + new SearchField("hotelName", SearchFieldDataType.STRING).setSearchable(true) ); SearchIndex searchIndex = new SearchIndex("searchIndex", searchFields); diff --git a/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/SynonymMapsCreateExample.java b/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/SynonymMapsCreateExample.java index 09dd900c513d..a18cb4d807cf 100644 --- a/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/SynonymMapsCreateExample.java +++ b/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/SynonymMapsCreateExample.java @@ -13,7 +13,6 @@ import com.azure.search.documents.indexes.models.SynonymMap; import java.util.Arrays; -import java.util.Collections; /** * This example shows how to create an index with a synonym map @@ -59,7 +58,7 @@ private static void assignSynonymMapToIndex(String synonymMapName) { new SearchField("HotelId", SearchFieldDataType.STRING) .setKey(true), new SearchField("HotelName", SearchFieldDataType.STRING) - .setSynonymMapNames(Collections.singletonList(synonymMapName)) + .setSynonymMapNames(synonymMapName) )); } } diff --git a/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/indexes/LifecycleSetupExample.java b/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/indexes/LifecycleSetupExample.java index e5b6d8c8a8b8..c6acd454d1b8 100644 --- a/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/indexes/LifecycleSetupExample.java +++ b/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/indexes/LifecycleSetupExample.java @@ -167,8 +167,7 @@ private static SearchIndex createIndex(SearchIndexClient client) { SearchIndex index = new SearchIndex(INDEX_NAME, fields); // Set Suggester - index.setSuggesters(Collections.singletonList(new SearchSuggester(SUGGESTER_NAME, - Collections.singletonList("Tags")))); + index.setSuggesters(new SearchSuggester(SUGGESTER_NAME, Collections.singletonList("Tags"))); return client.createOrUpdateIndex(index); } diff --git a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/IndexBatchTests.java b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/IndexBatchTests.java index 8e1560b4bbb7..7513e7b94010 100644 --- a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/IndexBatchTests.java +++ b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/IndexBatchTests.java @@ -2,9 +2,9 @@ // Licensed under the MIT License. package com.azure.search.documents; +import com.azure.search.documents.indexes.models.IndexDocumentsBatch; import com.azure.search.documents.models.IndexAction; import com.azure.search.documents.models.IndexActionType; -import com.azure.search.documents.indexes.models.IndexDocumentsBatch; import org.junit.jupiter.api.Test; import java.util.ArrayList; @@ -26,11 +26,11 @@ public void uploadDocument() { .setActionType(IndexActionType.UPLOAD) .setDocument(searchDocument); - IndexDocumentsBatch expected = new IndexDocumentsBatch( - Collections.singletonList(indexAction)); + IndexDocumentsBatch expected = new IndexDocumentsBatch() + .addActions(Collections.singletonList(indexAction)); IndexDocumentsBatch actual = new IndexDocumentsBatch() - .addUploadActions(searchDocument); + .addUploadActions(Collections.singletonList(searchDocument)); validate(expected, actual); } @@ -51,7 +51,8 @@ public void uploadDocuments() { .map(doc -> new IndexAction().setActionType(IndexActionType.UPLOAD).setDocument(doc)) .collect(Collectors.toList()); - IndexDocumentsBatch expectedBatch = new IndexDocumentsBatch(indexActions); + IndexDocumentsBatch expectedBatch = new IndexDocumentsBatch() + .addActions(indexActions); IndexDocumentsBatch actualBatch = new IndexDocumentsBatch() .addUploadActions(docs); @@ -68,11 +69,11 @@ public void mergeDocument() { .setActionType(IndexActionType.MERGE) .setDocument(searchDocument); - IndexDocumentsBatch expected = new IndexDocumentsBatch( - Collections.singletonList(indexAction)); + IndexDocumentsBatch expected = new IndexDocumentsBatch() + .addActions(Collections.singletonList(indexAction)); IndexDocumentsBatch actual = new IndexDocumentsBatch() - .addMergeActions(searchDocument); + .addMergeActions(Collections.singletonList(searchDocument)); validate(expected, actual); } @@ -93,7 +94,8 @@ public void mergeDocuments() { .map(doc -> new IndexAction().setActionType(IndexActionType.MERGE).setDocument(doc)) .collect(Collectors.toList()); - IndexDocumentsBatch expectedBatch = new IndexDocumentsBatch(indexActions); + IndexDocumentsBatch expectedBatch = new IndexDocumentsBatch() + .addActions(indexActions); IndexDocumentsBatch actualBatch = new IndexDocumentsBatch() .addMergeActions(docs); @@ -110,11 +112,11 @@ public void mergeOrUploadDocument() { .setActionType(IndexActionType.MERGE_OR_UPLOAD) .setDocument(searchDocument); - IndexDocumentsBatch expected = new IndexDocumentsBatch( - Collections.singletonList(indexAction)); + IndexDocumentsBatch expected = new IndexDocumentsBatch() + .addActions(Collections.singletonList(indexAction)); IndexDocumentsBatch actual = new IndexDocumentsBatch() - .addMergeOrUploadActions(searchDocument); + .addMergeOrUploadActions(Collections.singletonList(searchDocument)); validate(expected, actual); } @@ -135,7 +137,8 @@ public void mergeOrUploadDocuments() { .map(doc -> new IndexAction().setActionType(IndexActionType.MERGE_OR_UPLOAD).setDocument(doc)) .collect(Collectors.toList()); - IndexDocumentsBatch expectedBatch = new IndexDocumentsBatch(indexActions); + IndexDocumentsBatch expectedBatch = new IndexDocumentsBatch() + .addActions(indexActions); IndexDocumentsBatch actualBatch = new IndexDocumentsBatch() .addMergeOrUploadActions(docs); @@ -152,11 +155,11 @@ public void deleteDocument() { .setActionType(IndexActionType.DELETE) .setDocument(searchDocument); - IndexDocumentsBatch expected = new IndexDocumentsBatch( - Collections.singletonList(indexAction)); + IndexDocumentsBatch expected = new IndexDocumentsBatch() + .addActions(Collections.singletonList(indexAction)); IndexDocumentsBatch actual = new IndexDocumentsBatch() - .addDeleteActions(searchDocument); + .addDeleteActions(Collections.singletonList(searchDocument)); validate(expected, actual); } @@ -177,7 +180,8 @@ public void deleteDocuments() { .map(doc -> new IndexAction().setActionType(IndexActionType.DELETE).setDocument(doc)) .collect(Collectors.toList()); - IndexDocumentsBatch expectedBatch = new IndexDocumentsBatch(indexActions); + IndexDocumentsBatch expectedBatch = new IndexDocumentsBatch() + .addActions(indexActions); IndexDocumentsBatch actualBatch = new IndexDocumentsBatch() .addDeleteActions(docs); @@ -215,14 +219,14 @@ public void canBuildIndexBatchWithMultipleActionsAndSingleDocument() { .setActionType(IndexActionType.UPLOAD) .setDocument(documentToUpload); - IndexDocumentsBatch expected = new IndexDocumentsBatch( - Arrays.asList(mergeAction, mergeOrUploadAction, deleteAction, uploadAction)); + IndexDocumentsBatch expected = new IndexDocumentsBatch() + .addActions(Arrays.asList(mergeAction, mergeOrUploadAction, deleteAction, uploadAction)); IndexDocumentsBatch actual = new IndexDocumentsBatch() - .addMergeActions(documentToMerge) - .addMergeOrUploadActions(documentToMergeOrUpload) - .addDeleteActions(documentToDelete) - .addUploadActions(documentToUpload); + .addMergeActions(Collections.singletonList(documentToMerge)) + .addMergeOrUploadActions(Collections.singletonList(documentToMergeOrUpload)) + .addDeleteActions(Collections.singletonList(documentToDelete)) + .addUploadActions(Collections.singletonList(documentToUpload)); validate(expected, actual); } @@ -301,8 +305,8 @@ public void canBuildIndexBatchWithMultipleActionsAndMultipleDocuments() { .setActionType(IndexActionType.UPLOAD) .setDocument(documentsToUpload.get(1)); - IndexDocumentsBatch expected = new IndexDocumentsBatch( - Arrays.asList( + IndexDocumentsBatch expected = new IndexDocumentsBatch() + .addActions(Arrays.asList( mergeAction1, mergeAction2, mergeOrUploadAction1, @@ -310,9 +314,7 @@ public void canBuildIndexBatchWithMultipleActionsAndMultipleDocuments() { deleteAction1, deleteAction2, uploadAction1, - uploadAction2 - ) - ); + uploadAction2)); IndexDocumentsBatch actual = new IndexDocumentsBatch() .addMergeActions(documentsToMerge) diff --git a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/IndexingSyncTests.java b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/IndexingSyncTests.java index 1e9bf3ab965f..0659cf655c69 100644 --- a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/IndexingSyncTests.java +++ b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/IndexingSyncTests.java @@ -130,7 +130,7 @@ public void canDeleteBatchByKeys() { assertEquals(2, client.getDocumentCount()); IndexDocumentsBatch deleteBatch = new IndexDocumentsBatch() - .addDeleteActions("HotelId", "1", "2"); + .addDeleteActions("HotelId", Arrays.asList("1", "2")); IndexDocumentsResult documentIndexResult = client.indexDocuments(deleteBatch); waitForIndexing(); @@ -201,11 +201,11 @@ public void canIndexStaticallyTypedDocuments() throws ParseException { Hotel randomHotel = prepareStaticallyTypedHotel("randomId"); // deleting a non existing document IndexDocumentsBatch batch = new IndexDocumentsBatch() - .addUploadActions(hotel1) - .addDeleteActions(randomHotel) - .addMergeActions(nonExistingHotel) - .addMergeOrUploadActions(hotel3) - .addUploadActions(hotel2); + .addUploadActions(Collections.singletonList(hotel1)) + .addDeleteActions(Collections.singletonList(randomHotel)) + .addMergeActions(Collections.singletonList(nonExistingHotel)) + .addMergeOrUploadActions(Collections.singletonList(hotel3)) + .addUploadActions(Collections.singletonList(hotel2)); try { client.indexDocumentsWithResponse(batch, new IndexDocumentsOptions().setThrowOnAnyError(true), @@ -246,11 +246,11 @@ public void canIndexDynamicDocumentsNotThrow() { SearchDocument randomHotel = prepareDynamicallyTypedHotel("randomId"); // deleting a non existing document IndexDocumentsBatch batch = new IndexDocumentsBatch() - .addUploadActions(hotel1) - .addDeleteActions(randomHotel) - .addMergeActions(nonExistingHotel) - .addMergeOrUploadActions(hotel3) - .addUploadActions(hotel2); + .addUploadActions(Collections.singletonList(hotel1)) + .addDeleteActions(Collections.singletonList(randomHotel)) + .addMergeActions(Collections.singletonList(nonExistingHotel)) + .addMergeOrUploadActions(Collections.singletonList(hotel3)) + .addUploadActions(Collections.singletonList(hotel2)); Response resultResponse = client.indexDocumentsWithResponse(batch, new IndexDocumentsOptions().setThrowOnAnyError(false), Context.NONE); @@ -283,11 +283,11 @@ public void canIndexDynamicDocumentsThrowOnError() { SearchDocument randomHotel = prepareDynamicallyTypedHotel("randomId"); // deleting a non existing document IndexDocumentsBatch batch = new IndexDocumentsBatch() - .addUploadActions(hotel1) - .addDeleteActions(randomHotel) - .addMergeActions(nonExistingHotel) - .addMergeOrUploadActions(hotel3) - .addUploadActions(hotel2); + .addUploadActions(Collections.singletonList(hotel1)) + .addDeleteActions(Collections.singletonList(randomHotel)) + .addMergeActions(Collections.singletonList(nonExistingHotel)) + .addMergeOrUploadActions(Collections.singletonList(hotel3)) + .addUploadActions(Collections.singletonList(hotel2)); try { client.indexDocuments(batch); @@ -333,9 +333,7 @@ public void indexWithInvalidDocumentThrowsException() { public void canUseIndexWithReservedName() { String indexName = "prototype"; SearchIndex indexWithReservedName = new SearchIndex(indexName) - .setFields(Collections.singletonList(new SearchField("ID", SearchFieldDataType.STRING) - .setKey(Boolean.TRUE) - )); + .setFields(new SearchField("ID", SearchFieldDataType.STRING).setKey(Boolean.TRUE)); SearchIndexClient searchIndexClient = getSearchIndexClientBuilder().buildClient(); searchIndexClient.createOrUpdateIndex(indexWithReservedName); diff --git a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/LookupSyncTests.java b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/LookupSyncTests.java index c01d2bfc8e0a..4d4838b7b99d 100644 --- a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/LookupSyncTests.java +++ b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/LookupSyncTests.java @@ -279,7 +279,7 @@ public void getDynamicDocumentCannotAlwaysDetermineCorrectType() { // expectedDoc.put("Location", createPointGeometryString(40.760586, -73.975403)); expectedDoc.put("Rooms", Collections.singletonList(new SearchDocument(Collections.singletonMap("BaseRate", "NaN")))); - client.indexDocuments(new IndexDocumentsBatch<>().addUploadActions(indexedDoc)); + client.indexDocuments(new IndexDocumentsBatch<>().addUploadActions(Collections.singletonList(indexedDoc))); // Select only the fields set in the test case so we don't get superfluous data back. List selectedFields = Arrays.asList("HotelId", "LastRenovationDate", "Location", "Rooms/BaseRate"); @@ -296,7 +296,7 @@ public void canGetDocumentWithBase64EncodedKey() { SearchDocument expectedDoc = new SearchDocument(); expectedDoc.put("HotelId", complexKey); - client.indexDocuments(new IndexDocumentsBatch<>().addUploadActions(expectedDoc)); + client.indexDocuments(new IndexDocumentsBatch<>().addUploadActions(Collections.singletonList(expectedDoc))); assertEquals(client.getDocumentWithResponse(complexKey, SearchDocument.class, new ArrayList<>(expectedDoc.keySet()), Context.NONE).getValue(), expectedDoc); } @@ -314,7 +314,7 @@ public void roundTrippingDateTimeOffsetNormalizesToUtc() { expectedDoc.put("LastRenovationDate", OffsetDateTime.parse("2010-06-27T08:00Z")); - client.indexDocuments(new IndexDocumentsBatch<>().addUploadActions(indexedDoc)); + client.indexDocuments(new IndexDocumentsBatch<>().addUploadActions(Collections.singletonList(indexedDoc))); SearchDocument actualDoc = client.getDocumentWithResponse("1", SearchDocument.class, new ArrayList<>(expectedDoc.keySet()), Context.NONE).getValue(); assertMapEquals(expectedDoc, actualDoc, false); diff --git a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/SearchSyncTests.java b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/SearchSyncTests.java index 3498f1e13012..189640b88278 100644 --- a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/SearchSyncTests.java +++ b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/SearchSyncTests.java @@ -753,7 +753,7 @@ public void canSearchWithSynonyms() { SearchIndex hotelsIndex = searchIndexClient.getIndex(client.getIndexName()); hotelsIndex.getFields().stream() .filter(f -> fieldName.equals(f.getName())) - .findFirst().get().setSynonymMapNames(Collections.singletonList(synonymMapToDelete)); + .findFirst().get().setSynonymMapNames(synonymMapToDelete); // Update the index with the SynonymMap searchIndexClient.createOrUpdateIndex(hotelsIndex); 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 a4b3d6fc0703..883877dcba9d 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 @@ -197,187 +197,168 @@ protected SearchIndex createTestIndex(String indexName) { weights.put("Category", 2.0); String searchIndexName = indexName == null ? randomIndexName(HOTEL_INDEX_NAME) : indexName; return new SearchIndex(searchIndexName, Arrays.asList( - new SearchField("HotelId", SearchFieldDataType.STRING) - .setKey(Boolean.TRUE) - .setFilterable(Boolean.TRUE) - .setSortable(Boolean.TRUE) - .setFacetable(Boolean.TRUE) - .setHidden(Boolean.FALSE), - new SearchField("HotelName", SearchFieldDataType.STRING) - .setSearchable(Boolean.TRUE) - .setFilterable(Boolean.TRUE) - .setSortable(Boolean.TRUE) - .setHidden(Boolean.FALSE), - new SearchField("Description", SearchFieldDataType.STRING) - .setSearchable(Boolean.TRUE) - .setAnalyzerName(LexicalAnalyzerName.EN_LUCENE) - .setHidden(Boolean.FALSE), - new SearchField("DescriptionFr", SearchFieldDataType.STRING) - .setSearchable(Boolean.TRUE) - .setAnalyzerName(LexicalAnalyzerName.FR_LUCENE) - .setHidden(Boolean.FALSE), - new SearchField("Description_Custom", SearchFieldDataType.STRING) - .setSearchable(Boolean.TRUE) - .setSearchAnalyzerName(LexicalAnalyzerName.STOP) - .setIndexAnalyzerName(LexicalAnalyzerName.STOP) - .setHidden(Boolean.FALSE), - new SearchField("Category", SearchFieldDataType.STRING) - .setSearchable(Boolean.TRUE) - .setFilterable(Boolean.TRUE) - .setSortable(Boolean.TRUE) - .setFacetable(Boolean.TRUE) - .setHidden(Boolean.FALSE), - new SearchField("Tags", SearchFieldDataType.collection(SearchFieldDataType.STRING)) - .setSearchable(Boolean.TRUE) - .setFilterable(Boolean.TRUE) - .setFacetable(Boolean.TRUE) - .setHidden(Boolean.FALSE), - new SearchField("ParkingIncluded", SearchFieldDataType.BOOLEAN) - .setFilterable(Boolean.TRUE) - .setSortable(Boolean.TRUE) - .setFacetable(Boolean.TRUE) - .setHidden(Boolean.FALSE), - new SearchField("SmokingAllowed", SearchFieldDataType.BOOLEAN) - .setFilterable(Boolean.TRUE) - .setSortable(Boolean.TRUE) - .setFacetable(Boolean.TRUE) - .setHidden(Boolean.FALSE), - new SearchField("LastRenovationDate", SearchFieldDataType.DATE_TIME_OFFSET) - .setFilterable(Boolean.TRUE) - .setSortable(Boolean.TRUE) - .setFacetable(Boolean.TRUE) - .setHidden(Boolean.FALSE), - new SearchField("Rating", SearchFieldDataType.INT32) - .setFilterable(Boolean.TRUE) - .setSortable(Boolean.TRUE) - .setFacetable(Boolean.TRUE) - .setHidden(Boolean.FALSE), - new SearchField("Address", SearchFieldDataType.COMPLEX) - .setFields(Arrays.asList( - new SearchField("StreetAddress", SearchFieldDataType.STRING) - .setSearchable(Boolean.TRUE) - .setHidden(Boolean.FALSE), - new SearchField("City", SearchFieldDataType.STRING) - .setSearchable(Boolean.TRUE) - .setFilterable(Boolean.TRUE) - .setSortable(Boolean.TRUE) - .setFacetable(Boolean.TRUE) - .setHidden(Boolean.FALSE), - new SearchField("StateProvince", SearchFieldDataType.STRING) - .setSearchable(Boolean.TRUE) - .setFilterable(Boolean.TRUE) - .setSortable(Boolean.TRUE) - .setFacetable(Boolean.TRUE) - .setHidden(Boolean.FALSE), - new SearchField("Country", SearchFieldDataType.STRING) - .setSearchable(Boolean.TRUE) - .setFilterable(Boolean.TRUE) - .setSortable(Boolean.TRUE) - .setFacetable(Boolean.TRUE) - .setHidden(Boolean.FALSE), - new SearchField("PostalCode", SearchFieldDataType.STRING) - .setSearchable(Boolean.TRUE) - .setFilterable(Boolean.TRUE) - .setSortable(Boolean.TRUE) - .setFacetable(Boolean.TRUE) - .setHidden(Boolean.FALSE) - ) - ), - new SearchField("Location", SearchFieldDataType.GEOGRAPHY_POINT) - .setFilterable(Boolean.TRUE) - .setSortable(Boolean.TRUE) - .setHidden(Boolean.FALSE), - new SearchField("Rooms", SearchFieldDataType.collection(SearchFieldDataType.COMPLEX)) - .setFields(Arrays.asList( - new SearchField("Description", SearchFieldDataType.STRING) - .setSearchable(Boolean.TRUE) - .setAnalyzerName(LexicalAnalyzerName.EN_LUCENE), - new SearchField("DescriptionFr", SearchFieldDataType.STRING) - .setSearchable(Boolean.TRUE) - .setAnalyzerName(LexicalAnalyzerName.FR_LUCENE) - .setHidden(Boolean.FALSE), - new SearchField("Type", SearchFieldDataType.STRING) - .setSearchable(Boolean.TRUE) - .setFilterable(Boolean.TRUE) - .setFacetable(Boolean.TRUE) - .setHidden(Boolean.FALSE), - new SearchField("BaseRate", SearchFieldDataType.DOUBLE) - .setKey(Boolean.FALSE) - .setFilterable(Boolean.TRUE) - .setFacetable(Boolean.TRUE) - .setHidden(Boolean.FALSE), - new SearchField("BedOptions", SearchFieldDataType.STRING) - .setSearchable(Boolean.TRUE) - .setFilterable(Boolean.TRUE) - .setFacetable(Boolean.TRUE) - .setHidden(Boolean.FALSE), - new SearchField("SleepsCount", SearchFieldDataType.INT32) - .setFilterable(Boolean.TRUE) - .setFacetable(Boolean.TRUE) - .setHidden(Boolean.FALSE), - new SearchField("SmokingAllowed", SearchFieldDataType.BOOLEAN) - .setFilterable(Boolean.TRUE) - .setFacetable(Boolean.TRUE) - .setHidden(Boolean.FALSE), - new SearchField("Tags", SearchFieldDataType.collection(SearchFieldDataType.STRING)) - .setSearchable(Boolean.TRUE) - .setFilterable(Boolean.TRUE) - .setFacetable(Boolean.TRUE) - .setHidden(Boolean.FALSE) - ) - ), - new SearchField("TotalGuests", SearchFieldDataType.INT64) - .setFilterable(Boolean.TRUE) - .setSortable(Boolean.TRUE) - .setFacetable(Boolean.TRUE), - new SearchField("ProfitMargin", SearchFieldDataType.DOUBLE) - ) - ) - .setScoringProfiles(Arrays.asList( - new ScoringProfile("MyProfile") - .setFunctionAggregation(ScoringFunctionAggregation.AVERAGE) - .setFunctions(Arrays.asList( - new MagnitudeScoringFunction("Rating", 2.0, - new MagnitudeScoringParameters(1, 4) - .setShouldBoostBeyondRangeByConstant(true)) - .setInterpolation(ScoringFunctionInterpolation.CONSTANT), - new DistanceScoringFunction("Location", 1.5, - new DistanceScoringParameters("Loc", 5)) - .setInterpolation(ScoringFunctionInterpolation.LINEAR), - new FreshnessScoringFunction("LastRenovationDate", 1.1, - new FreshnessScoringParameters(Duration.ofDays(365))) - .setInterpolation(ScoringFunctionInterpolation.LOGARITHMIC) - )) - .setTextWeights(new TextWeights(weights)), - new ScoringProfile("ProfileTwo") - .setFunctionAggregation(ScoringFunctionAggregation.MAXIMUM) - .setFunctions(Collections.singletonList( - new TagScoringFunction("Tags", 1.5, - new TagScoringParameters("MyTags")) - .setInterpolation(ScoringFunctionInterpolation.LINEAR) - )), - new ScoringProfile("ProfileThree") - .setFunctionAggregation(ScoringFunctionAggregation.MINIMUM) - .setFunctions(Collections.singletonList( - new MagnitudeScoringFunction("Rating", 3.0, - new MagnitudeScoringParameters(0, 10) - .setShouldBoostBeyondRangeByConstant(false)) - .setInterpolation(ScoringFunctionInterpolation.QUADRATIC) - )), - new ScoringProfile("ProfileFour") - .setFunctionAggregation(ScoringFunctionAggregation.FIRST_MATCHING) - .setFunctions(Collections.singletonList( - new MagnitudeScoringFunction("Rating", 3.14, - new MagnitudeScoringParameters(1, 5) - .setShouldBoostBeyondRangeByConstant(false)) - .setInterpolation(ScoringFunctionInterpolation.CONSTANT) - )) - )) - .setDefaultScoringProfile("MyProfile") + new SearchField("HotelId", SearchFieldDataType.STRING) + .setKey(Boolean.TRUE) + .setFilterable(Boolean.TRUE) + .setSortable(Boolean.TRUE) + .setFacetable(Boolean.TRUE) + .setHidden(Boolean.FALSE), + new SearchField("HotelName", SearchFieldDataType.STRING) + .setSearchable(Boolean.TRUE) + .setFilterable(Boolean.TRUE) + .setSortable(Boolean.TRUE) + .setHidden(Boolean.FALSE), + new SearchField("Description", SearchFieldDataType.STRING) + .setSearchable(Boolean.TRUE) + .setAnalyzerName(LexicalAnalyzerName.EN_LUCENE) + .setHidden(Boolean.FALSE), + new SearchField("DescriptionFr", SearchFieldDataType.STRING) + .setSearchable(Boolean.TRUE) + .setAnalyzerName(LexicalAnalyzerName.FR_LUCENE) + .setHidden(Boolean.FALSE), + new SearchField("Description_Custom", SearchFieldDataType.STRING) + .setSearchable(Boolean.TRUE) + .setSearchAnalyzerName(LexicalAnalyzerName.STOP) + .setIndexAnalyzerName(LexicalAnalyzerName.STOP) + .setHidden(Boolean.FALSE), + new SearchField("Category", SearchFieldDataType.STRING) + .setSearchable(Boolean.TRUE) + .setFilterable(Boolean.TRUE) + .setSortable(Boolean.TRUE) + .setFacetable(Boolean.TRUE) + .setHidden(Boolean.FALSE), + new SearchField("Tags", SearchFieldDataType.collection(SearchFieldDataType.STRING)) + .setSearchable(Boolean.TRUE) + .setFilterable(Boolean.TRUE) + .setFacetable(Boolean.TRUE) + .setHidden(Boolean.FALSE), + new SearchField("ParkingIncluded", SearchFieldDataType.BOOLEAN) + .setFilterable(Boolean.TRUE) + .setSortable(Boolean.TRUE) + .setFacetable(Boolean.TRUE) + .setHidden(Boolean.FALSE), + new SearchField("SmokingAllowed", SearchFieldDataType.BOOLEAN) + .setFilterable(Boolean.TRUE) + .setSortable(Boolean.TRUE) + .setFacetable(Boolean.TRUE) + .setHidden(Boolean.FALSE), + new SearchField("LastRenovationDate", SearchFieldDataType.DATE_TIME_OFFSET) + .setFilterable(Boolean.TRUE) + .setSortable(Boolean.TRUE) + .setFacetable(Boolean.TRUE) + .setHidden(Boolean.FALSE), + new SearchField("Rating", SearchFieldDataType.INT32) + .setFilterable(Boolean.TRUE) + .setSortable(Boolean.TRUE) + .setFacetable(Boolean.TRUE) + .setHidden(Boolean.FALSE), + new SearchField("Address", SearchFieldDataType.COMPLEX) + .setFields(new SearchField("StreetAddress", SearchFieldDataType.STRING) + .setSearchable(Boolean.TRUE) + .setHidden(Boolean.FALSE), + new SearchField("City", SearchFieldDataType.STRING) + .setSearchable(Boolean.TRUE) + .setFilterable(Boolean.TRUE) + .setSortable(Boolean.TRUE) + .setFacetable(Boolean.TRUE) + .setHidden(Boolean.FALSE), + new SearchField("StateProvince", SearchFieldDataType.STRING) + .setSearchable(Boolean.TRUE) + .setFilterable(Boolean.TRUE) + .setSortable(Boolean.TRUE) + .setFacetable(Boolean.TRUE) + .setHidden(Boolean.FALSE), + new SearchField("Country", SearchFieldDataType.STRING) + .setSearchable(Boolean.TRUE) + .setFilterable(Boolean.TRUE) + .setSortable(Boolean.TRUE) + .setFacetable(Boolean.TRUE) + .setHidden(Boolean.FALSE), + new SearchField("PostalCode", SearchFieldDataType.STRING) + .setSearchable(Boolean.TRUE) + .setFilterable(Boolean.TRUE) + .setSortable(Boolean.TRUE) + .setFacetable(Boolean.TRUE) + .setHidden(Boolean.FALSE)), + new SearchField("Location", SearchFieldDataType.GEOGRAPHY_POINT) + .setFilterable(Boolean.TRUE) + .setSortable(Boolean.TRUE) + .setHidden(Boolean.FALSE), + new SearchField("Rooms", SearchFieldDataType.collection(SearchFieldDataType.COMPLEX)) + .setFields(new SearchField("Description", SearchFieldDataType.STRING) + .setSearchable(Boolean.TRUE) + .setAnalyzerName(LexicalAnalyzerName.EN_LUCENE), + new SearchField("DescriptionFr", SearchFieldDataType.STRING) + .setSearchable(Boolean.TRUE) + .setAnalyzerName(LexicalAnalyzerName.FR_LUCENE) + .setHidden(Boolean.FALSE), + new SearchField("Type", SearchFieldDataType.STRING) + .setSearchable(Boolean.TRUE) + .setFilterable(Boolean.TRUE) + .setFacetable(Boolean.TRUE) + .setHidden(Boolean.FALSE), + new SearchField("BaseRate", SearchFieldDataType.DOUBLE) + .setKey(Boolean.FALSE) + .setFilterable(Boolean.TRUE) + .setFacetable(Boolean.TRUE) + .setHidden(Boolean.FALSE), + new SearchField("BedOptions", SearchFieldDataType.STRING) + .setSearchable(Boolean.TRUE) + .setFilterable(Boolean.TRUE) + .setFacetable(Boolean.TRUE) + .setHidden(Boolean.FALSE), + new SearchField("SleepsCount", SearchFieldDataType.INT32) + .setFilterable(Boolean.TRUE) + .setFacetable(Boolean.TRUE) + .setHidden(Boolean.FALSE), + new SearchField("SmokingAllowed", SearchFieldDataType.BOOLEAN) + .setFilterable(Boolean.TRUE) + .setFacetable(Boolean.TRUE) + .setHidden(Boolean.FALSE), + new SearchField("Tags", SearchFieldDataType.collection(SearchFieldDataType.STRING)) + .setSearchable(Boolean.TRUE) + .setFilterable(Boolean.TRUE) + .setFacetable(Boolean.TRUE) + .setHidden(Boolean.FALSE)), + new SearchField("TotalGuests", SearchFieldDataType.INT64) + .setFilterable(Boolean.TRUE) + .setSortable(Boolean.TRUE) + .setFacetable(Boolean.TRUE), + new SearchField("ProfitMargin", SearchFieldDataType.DOUBLE) + )).setScoringProfiles(new ScoringProfile("MyProfile") + .setFunctionAggregation(ScoringFunctionAggregation.AVERAGE) + .setFunctions(new MagnitudeScoringFunction("Rating", 2.0, + new MagnitudeScoringParameters(1, 4) + .setShouldBoostBeyondRangeByConstant(true)) + .setInterpolation(ScoringFunctionInterpolation.CONSTANT), + new DistanceScoringFunction("Location", 1.5, + new DistanceScoringParameters("Loc", 5)) + .setInterpolation(ScoringFunctionInterpolation.LINEAR), + new FreshnessScoringFunction("LastRenovationDate", 1.1, + new FreshnessScoringParameters(Duration.ofDays(365))) + .setInterpolation(ScoringFunctionInterpolation.LOGARITHMIC)) + .setTextWeights(new TextWeights(weights)), + new ScoringProfile("ProfileTwo") + .setFunctionAggregation(ScoringFunctionAggregation.MAXIMUM) + .setFunctions(new TagScoringFunction("Tags", 1.5, + new TagScoringParameters("MyTags")) + .setInterpolation(ScoringFunctionInterpolation.LINEAR)), + new ScoringProfile("ProfileThree") + .setFunctionAggregation(ScoringFunctionAggregation.MINIMUM) + .setFunctions(new MagnitudeScoringFunction("Rating", 3.0, + new MagnitudeScoringParameters(0, 10) + .setShouldBoostBeyondRangeByConstant(false)) + .setInterpolation(ScoringFunctionInterpolation.QUADRATIC)), + new ScoringProfile("ProfileFour") + .setFunctionAggregation(ScoringFunctionAggregation.FIRST_MATCHING) + .setFunctions(new MagnitudeScoringFunction("Rating", 3.14, + new MagnitudeScoringParameters(1, 5) + .setShouldBoostBeyondRangeByConstant(false)) + .setInterpolation(ScoringFunctionInterpolation.CONSTANT)) + ).setDefaultScoringProfile("MyProfile") .setCorsOptions(new CorsOptions(Arrays.asList("http://tempuri.org", "http://localhost:80")) .setMaxAgeInSeconds(60L)) - .setSuggesters(Collections.singletonList(new SearchSuggester("FancySuggester", - Collections.singletonList("HotelName")))); + .setSuggesters(new SearchSuggester("FancySuggester", Collections.singletonList("HotelName"))); } protected SearchIndexerDataSourceConnection createTestSqlDataSourceObject() { diff --git a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/indexes/CustomAnalyzerSyncTests.java b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/indexes/CustomAnalyzerSyncTests.java index 0c08d69fb38c..e8580d40f85d 100644 --- a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/indexes/CustomAnalyzerSyncTests.java +++ b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/indexes/CustomAnalyzerSyncTests.java @@ -127,13 +127,9 @@ public void canSearchWithCustomAnalyzer() { .setAnalyzerName(customLexicalAnalyzerName) .setSearchable(true) )) - .setAnalyzers(Collections.singletonList( - new CustomAnalyzer(customLexicalAnalyzerName.toString(), LexicalTokenizerName.STANDARD) - .setCharFilters(Collections.singletonList(customCharFilterName)) - )) - .setCharFilters(Collections.singletonList( - new PatternReplaceCharFilter(customCharFilterName.toString(), "@", "_") - )); + .setAnalyzers(new CustomAnalyzer(customLexicalAnalyzerName.toString(), LexicalTokenizerName.STANDARD) + .setCharFilters(customCharFilterName)) + .setCharFilters(new PatternReplaceCharFilter(customCharFilterName.toString(), "@", "_")); searchIndexClient.createIndex(index); indexesToCleanup.add(index.getName()); @@ -198,8 +194,8 @@ public void canAnalyze() { assertFalse(iterator.hasNext()); request = new AnalyzeTextOptions("One's ", LexicalTokenizerName.WHITESPACE) - .setTokenFilters(Collections.singletonList(TokenFilterName.APOSTROPHE)) - .setCharFilters(Collections.singletonList(CharFilterName.HTML_STRIP)); + .setTokenFilters(TokenFilterName.APOSTROPHE) + .setCharFilters(CharFilterName.HTML_STRIP); results = searchIndexClient.analyzeText(index.getName(), request); // End offset is based on the original token, not the one emitted by the filters. iterator = results.iterator(); @@ -230,15 +226,14 @@ public void canAnalyzeWithAllPossibleNames() { .forEach(r -> searchIndexClient.analyzeText(index.getName(), r)); AnalyzeTextOptions request = new AnalyzeTextOptions("One two", LexicalTokenizerName.WHITESPACE) - .setTokenFilters(new ArrayList<>(TokenFilterName.values())) - .setCharFilters(new ArrayList<>(CharFilterName.values())); + .setTokenFilters(TokenFilterName.values().toArray(new TokenFilterName[0])) + .setCharFilters(CharFilterName.values().toArray(new CharFilterName[0])); searchIndexClient.analyzeText(index.getName(), request); } @Test public void addingCustomAnalyzerThrowsHttpExceptionByDefault() { - SearchIndex index = createTestIndex(null) - .setAnalyzers(Collections.singletonList(new StopAnalyzer("a1"))); + SearchIndex index = createTestIndex(null).setAnalyzers(new StopAnalyzer("a1")); searchIndexClient.createIndex(index); indexesToCleanup.add(index.getName()); @@ -253,8 +248,7 @@ public void addingCustomAnalyzerThrowsHttpExceptionByDefault() { @Test public void canAddCustomAnalyzerWithIndexDowntime() { - SearchIndex index = createTestIndex(null) - .setAnalyzers(Collections.singletonList(new StopAnalyzer("a1"))); + SearchIndex index = createTestIndex(null).setAnalyzers(new StopAnalyzer("a1")); searchIndexClient.createIndex(index); indexesToCleanup.add(index.getName()); @@ -302,12 +296,11 @@ public void canUseAllAnalysisComponentNames() { @Test public void canUseAllRegexFlagsAnalyzer() { - SearchIndex index = createTestIndex(null) - .setAnalyzers(Collections.singletonList(new PatternAnalyzer(generateName()) - .setStopwords(Arrays.asList("stop1", "stop2")) - .setLowerCaseTerms(true) - .setPattern(".*") - .setFlags(new ArrayList<>(RegexFlags.values())))); + SearchIndex index = createTestIndex(null).setAnalyzers(new PatternAnalyzer(generateName()) + .setStopwords("stop1", "stop2") + .setLowerCaseTerms(true) + .setPattern(".*") + .setFlags(new ArrayList<>(RegexFlags.values()))); SearchIndex createdIndex = searchIndexClient.createIndex(index); indexesToCleanup.add(index.getName()); @@ -318,7 +311,7 @@ public void canUseAllRegexFlagsAnalyzer() { @Test public void canUseAllRegexFlagsNullAnalyzer() { SearchIndex index = createTestIndex(null) - .setAnalyzers(null); + .setAnalyzers((List) null); SearchIndex createdIndex = searchIndexClient.createIndex(index); indexesToCleanup.add(index.getName()); @@ -339,23 +332,16 @@ public void canUseAllRegexFlagsEmptyAnalyzer() { @Test public void canUseAllRegexFlagsNullNameAnalyzer() { - SearchIndex index = createTestIndex(null) - .setAnalyzers(Collections.singletonList( - new PatternAnalyzer(null) - )); + SearchIndex index = createTestIndex(null).setAnalyzers(new PatternAnalyzer(null)); - assertThrows(IllegalArgumentException.class, () -> { - searchIndexClient.createIndex(index); - }, "Missing required property name in model LexicalAnalyzer"); + assertThrows(IllegalArgumentException.class, () -> + searchIndexClient.createIndex(index), "Missing required property name in model LexicalAnalyzer"); } @Test public void canUseAllRegexFlagsEmptyNameAnalyzer() { - SearchIndex index = createTestIndex(null) - .setAnalyzers(Collections.singletonList( - new PatternAnalyzer("") - )); + SearchIndex index = createTestIndex(null).setAnalyzers(new PatternAnalyzer("")); assertHttpResponseException( () -> searchIndexClient.createIndex(index), @@ -367,9 +353,7 @@ public void canUseAllRegexFlagsEmptyNameAnalyzer() { @Test public void canUseAllRegexFlagsNullLowerCaseAnalyzer() { SearchIndex index = createTestIndex(null) - .setAnalyzers(Collections.singletonList( - new PatternAnalyzer(generateName()).setLowerCaseTerms(null) - )); + .setAnalyzers(new PatternAnalyzer(generateName()).setLowerCaseTerms(null)); SearchIndex createdIndex = searchIndexClient.createIndex(index); indexesToCleanup.add(index.getName()); @@ -380,9 +364,7 @@ public void canUseAllRegexFlagsNullLowerCaseAnalyzer() { @Test public void canUseAllRegexFlagsNullPatternAnalyzer() { SearchIndex index = createTestIndex(null) - .setAnalyzers(Collections.singletonList( - new PatternAnalyzer(generateName()).setPattern(null) - )); + .setAnalyzers(new PatternAnalyzer(generateName()).setPattern(null)); SearchIndex createdIndex = searchIndexClient.createIndex(index); indexesToCleanup.add(index.getName()); @@ -393,22 +375,7 @@ public void canUseAllRegexFlagsNullPatternAnalyzer() { @Test public void canUseAllRegexFlagsEmptyPatternAnalyzer() { SearchIndex index = createTestIndex(null) - .setAnalyzers(Collections.singletonList( - new PatternAnalyzer(generateName()).setPattern("")) - ); - - SearchIndex createdIndex = searchIndexClient.createIndex(index); - indexesToCleanup.add(index.getName()); - - assertAnalysisComponentsEqual(index, createdIndex); - } - - @Test - public void canUseAllRegexFlagsNullFlagsAnalyzer() { - SearchIndex index = createTestIndex(null) - .setAnalyzers(Collections.singletonList( - new PatternAnalyzer(generateName()).setFlags(null)) - ); + .setAnalyzers(new PatternAnalyzer(generateName()).setPattern("")); SearchIndex createdIndex = searchIndexClient.createIndex(index); indexesToCleanup.add(index.getName()); @@ -419,9 +386,7 @@ public void canUseAllRegexFlagsNullFlagsAnalyzer() { @Test public void canUseAllRegexFlagsEmptyFlagsAnalyzer() { SearchIndex index = createTestIndex(null) - .setAnalyzers(Collections.singletonList( - new PatternAnalyzer(generateName()).setFlags(new ArrayList<>())) - ); + .setAnalyzers(new PatternAnalyzer(generateName()).setFlags()); assertHttpResponseException( () -> searchIndexClient.createIndex(index), @@ -430,23 +395,10 @@ public void canUseAllRegexFlagsEmptyFlagsAnalyzer() { ); } - @Test - public void canUseAllRegexFlagsNullStopwordsAnalyzer() { - SearchIndex index = createTestIndex(null) - .setAnalyzers(Collections.singletonList(new PatternAnalyzer(generateName()) - .setStopwords(null))); - - SearchIndex createdIndex = searchIndexClient.createIndex(index); - indexesToCleanup.add(index.getName()); - - assertAnalysisComponentsEqual(index, createdIndex); - } - @Test public void canUseAllRegexFlagsEmptyStopwordsAnalyzer() { SearchIndex index = createTestIndex(null) - .setAnalyzers(Collections.singletonList(new PatternAnalyzer(generateName()) - .setStopwords(new ArrayList<>()))); + .setAnalyzers(new PatternAnalyzer(generateName()).setStopwords()); SearchIndex createdIndex = searchIndexClient.createIndex(index); indexesToCleanup.add(index.getName()); @@ -457,10 +409,10 @@ public void canUseAllRegexFlagsEmptyStopwordsAnalyzer() { @Test public void canUseAllRegexFlagsTokenizer() { SearchIndex index = createTestIndex(null) - .setTokenizers(Collections.singletonList(new PatternTokenizer(generateName()) + .setTokenizers(new PatternTokenizer(generateName()) .setPattern(".*") .setFlags(new ArrayList<>(RegexFlags.values())) - .setGroup(0))); + .setGroup(0)); SearchIndex createdIndex = searchIndexClient.createIndex(index); indexesToCleanup.add(index.getName()); @@ -471,7 +423,7 @@ public void canUseAllRegexFlagsTokenizer() { @Test public void canUseAllRegexFlagsNullTokenizer() { SearchIndex index = createTestIndex(null) - .setTokenizers(null); + .setTokenizers((List) null); SearchIndex createdIndex = searchIndexClient.createIndex(index); indexesToCleanup.add(index.getName()); @@ -493,19 +445,17 @@ public void canUseAllRegexFlagsEmptyTokenizer() { @Test public void canUseAllRegexFlagsNullNameTokenizer() { SearchIndex index = createTestIndex(null) - .setTokenizers(Collections.singletonList(new PatternTokenizer(null))); + .setTokenizers(new PatternTokenizer(null)); - assertThrows(IllegalArgumentException.class, () -> { - searchIndexClient.createIndex(index); - }, "Missing required property name in model SearchIndexer"); + assertThrows(IllegalArgumentException.class, () -> + searchIndexClient.createIndex(index), "Missing required property name in model SearchIndexer"); } @Test public void canUseAllRegexFlagsEmptyNameTokenizer() { SearchIndex index = createTestIndex(null) - .setTokenizers(Collections.singletonList(new PatternTokenizer("") - )); + .setTokenizers(new PatternTokenizer("")); assertHttpResponseException( () -> searchIndexClient.createIndex(index), @@ -517,8 +467,7 @@ public void canUseAllRegexFlagsEmptyNameTokenizer() { @Test public void canUseAllRegexFlagsNullPatternTokenizer() { SearchIndex index = createTestIndex(null) - .setTokenizers(Collections.singletonList(new PatternTokenizer(generateName()) - .setPattern(null))); + .setTokenizers(new PatternTokenizer(generateName()).setPattern(null)); SearchIndex createdIndex = searchIndexClient.createIndex(index); indexesToCleanup.add(index.getName()); @@ -529,35 +478,18 @@ public void canUseAllRegexFlagsNullPatternTokenizer() { @Test public void canUseAllRegexFlagsEmptyPatternTokenizer() { SearchIndex index = createTestIndex(null) - .setTokenizers(Collections.singletonList(new PatternTokenizer(generateName()) - .setPattern("")) - ); - - SearchIndex createdIndex = searchIndexClient.createIndex(index); - indexesToCleanup.add(index.getName()); - - assertAnalysisComponentsEqual(index, createdIndex); - } - - @Test - public void canUseAllRegexFlagsNullFlagsTokenizer() { - SearchIndex index = createTestIndex(null) - .setTokenizers(Collections.singletonList(new PatternTokenizer(generateName()) - .setFlags(null))); + .setTokenizers(new PatternTokenizer(generateName()).setPattern("")); SearchIndex createdIndex = searchIndexClient.createIndex(index); indexesToCleanup.add(index.getName()); assertAnalysisComponentsEqual(index, createdIndex); - System.out.println(RegexFlags.values()); } @Test public void canUseAllRegexFlagsEmptyFlagsTokenizer() { SearchIndex index = createTestIndex(null) - .setTokenizers(Collections.singletonList(new PatternTokenizer(generateName()) - .setFlags(new ArrayList<>())) - ); + .setTokenizers(new PatternTokenizer(generateName()).setFlags()); assertHttpResponseException( () -> searchIndexClient.createIndex(index), @@ -569,8 +501,7 @@ public void canUseAllRegexFlagsEmptyFlagsTokenizer() { @Test public void canUseAllRegexFlagsNullGroupTokenizer() { SearchIndex index = createTestIndex(null) - .setTokenizers(Collections.singletonList(new PatternTokenizer(generateName()) - .setGroup(null))); + .setTokenizers(new PatternTokenizer(generateName()).setGroup(null)); SearchIndex createdIndex = searchIndexClient.createIndex(index); indexesToCleanup.add(index.getName()); @@ -672,8 +603,7 @@ List prepareIndexesWithAllAnalysisComponentOptions() { new EdgeNGramTokenizer(generateName()) .setMinGram(1) .setMaxGram(2) - .setTokenChars(Arrays.asList(TokenCharacterKind.values())) - ); + .setTokenChars(TokenCharacterKind.values())); tokenizers.addAll( Arrays.stream(MicrosoftStemmingTokenizerLanguage.values()) .map(mtl -> new MicrosoftLanguageStemmingTokenizer(generateName()) @@ -688,7 +618,7 @@ List prepareIndexesWithAllAnalysisComponentOptions() { // Set token filters List tokenFilters = new ArrayList<>(); tokenFilters.add(new CjkBigramTokenFilter(generateName()) - .setIgnoreScripts(Arrays.asList(CjkBigramTokenFilterScripts.values())) + .setIgnoreScripts(CjkBigramTokenFilterScripts.values()) .setOutputUnigrams(true)); tokenFilters.addAll( Arrays.stream(EdgeNGramTokenFilterSide.values()) @@ -850,35 +780,34 @@ SearchIndex prepareIndexWithAllAnalysisComponentTypes() { final CharFilterName customCharFilterName = CharFilterName.fromString("my_charfilter"); return createTestIndex(null) - .setAnalyzers(Arrays.asList( + .setAnalyzers( new CustomAnalyzer(generateName(), customTokenizerName) - .setTokenFilters(Collections.singletonList(customTokenFilterName)) - .setCharFilters(Collections.singletonList(customCharFilterName)), + .setTokenFilters(customTokenFilterName) + .setCharFilters(customCharFilterName), new CustomAnalyzer(generateName(), LexicalTokenizerName.EDGE_NGRAM), new PatternAnalyzer(generateName()) .setLowerCaseTerms(false) .setPattern("abc") - .setFlags(Collections.singletonList(RegexFlags.DOT_ALL)) - .setStopwords(Collections.singletonList("the")), + .setFlags(RegexFlags.DOT_ALL) + .setStopwords("the"), new LuceneStandardAnalyzer(generateName()) .setMaxTokenLength(100) - .setStopwords(Collections.singletonList("the")), - new StopAnalyzer(generateName()) - .setStopwords(Collections.singletonList("the")), + .setStopwords("the"), new StopAnalyzer(generateName()) - )) - .setTokenizers(Arrays.asList( + .setStopwords("the"), + new StopAnalyzer(generateName())) + .setTokenizers( new EdgeNGramTokenizer(customTokenizerName.toString()) .setMinGram(1) .setMaxGram(2), new EdgeNGramTokenizer(generateName()) .setMinGram(2) .setMaxGram(4) - .setTokenChars(Collections.singletonList(TokenCharacterKind.LETTER)), + .setTokenChars(TokenCharacterKind.LETTER), new NGramTokenizer(generateName()) .setMinGram(2) .setMaxGram(4) - .setTokenChars(Collections.singletonList(TokenCharacterKind.LETTER)), + .setTokenChars(TokenCharacterKind.LETTER), new ClassicTokenizer(generateName()) .setMaxTokenLength(100), new KeywordTokenizer(generateName()) @@ -899,17 +828,16 @@ SearchIndex prepareIndexWithAllAnalysisComponentTypes() { .setNumberOfTokensToSkip(2), new PatternTokenizer(generateName()) .setPattern(".*") - .setFlags(Collections.singletonList(RegexFlags.MULTILINE)) + .setFlags(RegexFlags.MULTILINE) .setGroup(0), new LuceneStandardTokenizer(generateName()) .setMaxTokenLength(100), new UaxUrlEmailTokenizer(generateName()) - .setMaxTokenLength(100) - )) - .setTokenFilters(Arrays.asList( + .setMaxTokenLength(100)) + .setTokenFilters( new CjkBigramTokenFilter(customTokenFilterName.toString()), // One custom token filter for CustomAnalyzer above. new CjkBigramTokenFilter(generateName()) - .setIgnoreScripts(Collections.singletonList(CjkBigramTokenFilterScripts.HAN)) + .setIgnoreScripts(CjkBigramTokenFilterScripts.HAN) .setOutputUnigrams(true), new CjkBigramTokenFilter(generateName()), new AsciiFoldingTokenFilter(generateName()) @@ -929,7 +857,7 @@ SearchIndex prepareIndexWithAllAnalysisComponentTypes() { .setMaxGram(10) .setSide(EdgeNGramTokenFilterSide.BACK), new ElisionTokenFilter(generateName()) - .setArticles(Collections.singletonList("a")), + .setArticles("a"), new ElisionTokenFilter(generateName()), new KeepTokenFilter(generateName(), Collections.singletonList("aloha")), new KeepTokenFilter(generateName(), Arrays.asList("e", "komo", "mai")), @@ -986,13 +914,11 @@ SearchIndex prepareIndexWithAllAnalysisComponentTypes() { .setPreserveOriginal(true) .setSplitOnNumerics(false) .setStemEnglishPossessive(false) - .setProtectedWords(Collections.singletonList("protected")))) - .setCharFilters(Arrays.asList( - new MappingCharFilter(customCharFilterName.toString(), + .setProtectedWords("protected")) + .setCharFilters(new MappingCharFilter(customCharFilterName.toString(), Collections.singletonList("a => b")), // One custom char filter for CustomeAnalyer above. new MappingCharFilter(generateName(), Arrays.asList("s => $", "S => $")), - new PatternReplaceCharFilter(generateName(), "abc", "123") - )); + new PatternReplaceCharFilter(generateName(), "abc", "123")); } SearchIndex createIndexWithSpecialDefaults() { diff --git a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/indexes/FieldBuilderTests.java b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/indexes/FieldBuilderTests.java index 11377b669a94..a0b60ca93ac7 100644 --- a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/indexes/FieldBuilderTests.java +++ b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/indexes/FieldBuilderTests.java @@ -4,11 +4,8 @@ package com.azure.search.documents.indexes; import com.azure.search.documents.TestHelpers; -import com.azure.search.documents.indexes.models.ComplexFieldBuilder; import com.azure.search.documents.indexes.models.SearchField; import com.azure.search.documents.indexes.models.SearchFieldDataType; -import com.azure.search.documents.indexes.models.SearchableFieldBuilder; -import com.azure.search.documents.indexes.models.SimpleFieldBuilder; import com.azure.search.documents.test.environment.models.HotelAnalyzerException; import com.azure.search.documents.test.environment.models.HotelCircularDependencies; import com.azure.search.documents.test.environment.models.HotelSearchException; @@ -54,8 +51,16 @@ public void hotelCircularDependencies() { public void hotelWithEmptySynonymMaps() { // We cannot put null in the annotation. So no need to test null case. List actualFields = FieldBuilder.build(HotelWithEmptyInSynonymMaps.class); - List expectedFields = Collections.singletonList(new SearchableFieldBuilder("tags", true) - .setSynonymMapNames(Arrays.asList("asynonymMaps", "maps")).build()); + + List expectedFields = Collections.singletonList(new SearchField("tags", + SearchFieldDataType.collection(SearchFieldDataType.STRING)) + .setSearchable(true) + .setKey(false) + .setFilterable(false) + .setSortable(false) + .setFacetable(false) + .setSynonymMapNames(Arrays.asList("asynonymMaps", "maps"))); + assertListFieldEquals(expectedFields, actualFields); } @@ -95,43 +100,55 @@ private void assertExceptionMassageAndDataType(Exception exception, SearchFieldD } private List buildHotelCircularDependenciesModel() { - SearchField homeAddress = new ComplexFieldBuilder("homeAddress", false).setFields(buildHotelInAddress()).build(); - SearchField billingAddress = new ComplexFieldBuilder("billingAddress", false).setFields(buildHotelInAddress()).build(); + SearchField homeAddress = new SearchField("homeAddress", SearchFieldDataType.COMPLEX) + .setFields(buildHotelInAddress()); + SearchField billingAddress = new SearchField("billingAddress", SearchFieldDataType.COMPLEX) + .setFields(buildHotelInAddress()); return Arrays.asList(homeAddress, billingAddress); } private List buildHotelInAddress() { - SearchField hotel = new ComplexFieldBuilder("hotel", false).build(); + SearchField hotel = new SearchField("hotel", SearchFieldDataType.COMPLEX); return Collections.singletonList(hotel); } private List buildHotelWithArrayModel() { - SearchField hotelId = new SimpleFieldBuilder("hotelId", SearchFieldDataType.STRING, false).setKey(true) - .setSortable(true).build(); - SearchField tags = new SearchableFieldBuilder("tags", true).build(); + SearchField hotelId = new SearchField("hotelId", SearchFieldDataType.STRING) + .setKey(true) + .setSortable(true) + .setSearchable(false) + .setFacetable(false) + .setFilterable(false); + SearchField tags = new SearchField("tags", SearchFieldDataType.collection(SearchFieldDataType.STRING)) + .setKey(false) + .setSearchable(true) + .setSortable(false) + .setFilterable(false) + .setFacetable(false); return Arrays.asList(hotelId, tags); } private List buildHotelAddressField() { - SearchField streetAddress = new SimpleFieldBuilder("streetAddress", SearchFieldDataType.STRING, false).setFacetable(true) - .setKey(true).build(); - SearchField city = new SearchableFieldBuilder("city", false).setFilterable(true).build(); - SearchField stateProvince = new SearchableFieldBuilder("stateProvince", false).build(); - SearchField country = new SearchableFieldBuilder("country", false) - .setSynonymMapNames(Arrays.asList("America -> USA", "USA -> US")).build(); - SearchField postalCode = new SimpleFieldBuilder("postalCode", SearchFieldDataType.STRING, false).build(); + SearchField streetAddress = new SearchField("streetAddress", SearchFieldDataType.STRING).setFacetable(true) + .setKey(true); + SearchField city = new SearchField("city", SearchFieldDataType.STRING).setFilterable(true); + SearchField stateProvince = new SearchField("stateProvince", SearchFieldDataType.STRING); + SearchField country = + new SearchField("country", SearchFieldDataType.STRING).setSynonymMapNames(Arrays.asList("America -> USA", + "USA -> US")); + SearchField postalCode = new SearchField("postalCode", SearchFieldDataType.STRING); return Arrays.asList(streetAddress, city, stateProvince, country, postalCode); } private List buildHotelRoomField() { - SearchField description = new SimpleFieldBuilder("description", SearchFieldDataType.STRING, false).build(); - SearchField descriptionFr = new SimpleFieldBuilder("descriptionFr", SearchFieldDataType.STRING, false).build(); - SearchField type = new SimpleFieldBuilder("type", SearchFieldDataType.STRING, false).build(); - SearchField baseRate = new SimpleFieldBuilder("baseRate", SearchFieldDataType.DOUBLE, false).build(); - SearchField bedOptions = new SimpleFieldBuilder("bedOptions", SearchFieldDataType.STRING, false).build(); - SearchField sleepsCount = new SimpleFieldBuilder("sleepsCount", SearchFieldDataType.INT32, false).build(); - SearchField smokingAllowed = new SimpleFieldBuilder("smokingAllowed", SearchFieldDataType.BOOLEAN, false).build(); - SearchField tags = new SimpleFieldBuilder("tags", SearchFieldDataType.STRING, true).build(); + SearchField description = new SearchField("description", SearchFieldDataType.STRING); + SearchField descriptionFr = new SearchField("descriptionFr", SearchFieldDataType.STRING); + SearchField type = new SearchField("type", SearchFieldDataType.STRING); + SearchField baseRate = new SearchField("baseRate", SearchFieldDataType.DOUBLE); + SearchField bedOptions = new SearchField("bedOptions", SearchFieldDataType.STRING); + SearchField sleepsCount = new SearchField("sleepsCount", SearchFieldDataType.INT32); + SearchField smokingAllowed = new SearchField("smokingAllowed", SearchFieldDataType.BOOLEAN); + SearchField tags = new SearchField("tags", SearchFieldDataType.collection(SearchFieldDataType.STRING)); return Arrays.asList(description, descriptionFr, type, baseRate, bedOptions, sleepsCount, smokingAllowed, tags); } diff --git a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/indexes/IndexManagementSyncTests.java b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/indexes/IndexManagementSyncTests.java index 9f4363ffa40e..8506e195951a 100644 --- a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/indexes/IndexManagementSyncTests.java +++ b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/indexes/IndexManagementSyncTests.java @@ -99,11 +99,8 @@ public void createIndexReturnsCorrectDefinitionWithResponse() { public void createIndexReturnsCorrectDefaultValues() { SearchIndex index = createTestIndex(null) .setCorsOptions(new CorsOptions(Collections.singletonList("*"))) - .setScoringProfiles(Collections.singletonList(new ScoringProfile("MyProfile") - .setFunctions(Collections.singletonList(new MagnitudeScoringFunction("Rating", 2.0, - new MagnitudeScoringParameters(1, 4))) - ) - )); + .setScoringProfiles(new ScoringProfile("MyProfile") + .setFunctions(new MagnitudeScoringFunction("Rating", 2.0, new MagnitudeScoringParameters(1, 4)))); SearchIndex indexResponse = client.createIndex(index); indexesToDelete.add(indexResponse.getName()); @@ -118,10 +115,7 @@ public void createIndexReturnsCorrectDefaultValues() { public void createIndexFailsWithUsefulMessageOnUserError() { String indexName = HOTEL_INDEX_NAME; SearchIndex index = new SearchIndex(indexName) - .setFields(Collections.singletonList( - new SearchField("HotelId", SearchFieldDataType.STRING) - .setKey(false) - )); + .setFields(new SearchField("HotelId", SearchFieldDataType.STRING).setKey(false)); String expectedMessage = String.format("The request is invalid. Details: index : Found 0 key fields in index '%s'. " + "Each index must have exactly one key field.", indexName); @@ -174,7 +168,7 @@ public void deleteIndexIfNotChangedWorksOnlyOnCurrentResource() { // Update the resource, the eTag will be changed SearchIndex updatedIndex = client.createOrUpdateIndexWithResponse(originalIndex - .setCorsOptions(new CorsOptions(Collections.singletonList("https://test.com/"))), false, false, + .setCorsOptions(new CorsOptions(Collections.singletonList("https://test.com/"))), false, false, Context.NONE) .getValue(); @@ -207,10 +201,7 @@ public void deleteIndexIfExistsWorksOnlyWhenResourceExists() { @Test public void deleteIndexIsIdempotent() { SearchIndex index = new SearchIndex(HOTEL_INDEX_NAME) - .setFields(Collections.singletonList( - new SearchField("HotelId", SearchFieldDataType.STRING) - .setKey(true) - )); + .setFields(new SearchField("HotelId", SearchFieldDataType.STRING).setKey(true)); Response deleteResponse = client.deleteIndexWithResponse(index, false, Context.NONE); assertEquals(HttpURLConnection.HTTP_NOT_FOUND, deleteResponse.getStatusCode()); @@ -288,8 +279,7 @@ public void canAddSynonymFieldProperty() { new SearchField("HotelId", SearchFieldDataType.STRING) .setKey(true), new SearchField("HotelName", SearchFieldDataType.STRING) - .setSynonymMapNames(Collections.singletonList(synonymMapName)) - )); + .setSynonymMapNames(synonymMapName))); SearchIndex createdIndex = client.createIndex(index); indexesToDelete.add(createdIndex.getName()); @@ -311,7 +301,7 @@ public void canUpdateSynonymFieldProperty() { // Create an index SearchIndex index = createTestIndex(null); SearchField hotelNameField = getFieldByName(index, "HotelName"); - hotelNameField.setSynonymMapNames(Collections.singletonList(synonymMapName)); + hotelNameField.setSynonymMapNames(synonymMapName); client.createIndex(index); indexesToDelete.add(index.getName()); @@ -361,7 +351,7 @@ public void canUpdateIndexDefinition() { SearchField tagsField = getFieldByName(existingIndex, "Description_Custom"); tagsField.setHidden(true) .setSearchAnalyzerName(LexicalAnalyzerName.WHITESPACE) - .setSynonymMapNames(Collections.singletonList(synonymMap.getName())); + .setSynonymMapNames(synonymMap.getName()); SearchField hotelWebSiteField = new SearchField("HotelWebsite", SearchFieldDataType.STRING) .setSearchable(Boolean.TRUE) @@ -388,9 +378,7 @@ public void canUpdateSuggesterWithNewIndexFields() { existingIndex.getFields().addAll(Arrays.asList( new SearchField("HotelAmenities", SearchFieldDataType.STRING), new SearchField("HotelRewards", SearchFieldDataType.STRING))); - existingIndex.setSuggesters(Collections.singletonList(new SearchSuggester("Suggestion", - Arrays.asList("HotelAmenities", "HotelRewards")) - )); + existingIndex.setSuggesters(new SearchSuggester("Suggestion", Arrays.asList("HotelAmenities", "HotelRewards"))); SearchIndex updatedIndex = client.createOrUpdateIndexWithResponse(existingIndex, true, false, Context.NONE).getValue(); @@ -405,9 +393,7 @@ public void createOrUpdateIndexThrowsWhenUpdatingSuggesterWithExistingIndexField SearchIndex existingIndex = client.getIndex(index.getName()); String existingFieldName = "Category"; - existingIndex.setSuggesters(Collections.singletonList(new SearchSuggester("Suggestion", - Collections.singletonList(existingFieldName)) - )); + existingIndex.setSuggesters(new SearchSuggester("Suggestion", Collections.singletonList(existingFieldName))); assertHttpResponseException( () -> client.createOrUpdateIndex(existingIndex), diff --git a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/indexes/SkillsetManagementSyncTests.java b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/indexes/SkillsetManagementSyncTests.java index 7f33727e0961..1f88f93b504b 100644 --- a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/indexes/SkillsetManagementSyncTests.java +++ b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/indexes/SkillsetManagementSyncTests.java @@ -122,10 +122,8 @@ public void createSkillsetReturnsCorrectDefinitionOcrEntity() { skillsetsToDelete.add(actualSkillset.getName()); assertObjectEquals(expectedSkillset, actualSkillset, true, "etag"); - List entityCategories = Arrays.asList( - EntityCategory.LOCATION, EntityCategory.ORGANIZATION, EntityCategory.PERSON); - - expectedSkillset = createTestSkillsetOcrEntity(entityCategories); + expectedSkillset = createTestSkillsetOcrEntity(Arrays.asList(EntityCategory.LOCATION, + EntityCategory.ORGANIZATION, EntityCategory.PERSON)); actualSkillset = client.createSkillset(expectedSkillset); skillsetsToDelete.add(actualSkillset.getName()); assertObjectEquals(expectedSkillset, actualSkillset, true, "etag"); @@ -612,7 +610,7 @@ SearchIndexerSkillset createTestSkillsetImageAnalysisKeyPhrase() { skills.add(new ImageAnalysisSkill(inputs, outputs) .setVisualFeatures(new ArrayList<>(VisualFeature.values())) - .setDetails(new ArrayList<>((ImageDetail.values()))) + .setDetails(new ArrayList<>(ImageDetail.values())) .setDefaultLanguageCode(ImageAnalysisSkillLanguage.EN) .setName("myimage") .setDescription("Tested image analysis skill") @@ -743,15 +741,13 @@ SearchIndexerSkillset createTestSkillsetConditional() { } SearchIndexerSkillset mutateSkillsInSkillset(SearchIndexerSkillset skillset) { - return skillset.setSkills(Collections.singletonList( - new KeyPhraseExtractionSkill(Collections - .singletonList(simpleInputFieldMappingEntry("text", "/document/mydescription/*/Tags/*")), - Collections.singletonList(createOutputFieldMappingEntry("keyPhrases", "myKeyPhrases"))) - .setDefaultLanguageCode(KeyPhraseExtractionSkillLanguage.EN) - .setName("mykeyphrases") - .setDescription("Tested Key Phrase skill") - .setContext(CONTEXT_VALUE) - )); + return skillset.setSkills(new KeyPhraseExtractionSkill(Collections + .singletonList(simpleInputFieldMappingEntry("text", "/document/mydescription/*/Tags/*")), + Collections.singletonList(createOutputFieldMappingEntry("keyPhrases", "myKeyPhrases"))) + .setDefaultLanguageCode(KeyPhraseExtractionSkillLanguage.EN) + .setName("mykeyphrases") + .setDescription("Tested Key Phrase skill") + .setContext(CONTEXT_VALUE)); } SearchIndexerSkillset createTestSkillsetOcrEntity(List categories) { @@ -945,7 +941,7 @@ SearchIndexerSkillset createSkillsetWithKeyPhraseExtractionDefaultSettings() { ); return new SearchIndexerSkillset(testResourceNamer.randomName("key-phrase-extraction-skillset", 48), - skills).setDescription("Skillset for testing default configuration"); + skills).setDescription("Skillset for testing default configuration"); } SearchIndexerSkillset createSkillsetWithMergeDefaultSettings() { diff --git a/sdk/search/tests.yml b/sdk/search/tests.yml index 4b3c335e3e50..f205c2721284 100644 --- a/sdk/search/tests.yml +++ b/sdk/search/tests.yml @@ -4,8 +4,8 @@ jobs: - template: ../../eng/pipelines/templates/jobs/archetype-sdk-tests.yml parameters: ServiceDirectory: search - Timeout: 120 - MaxParallel: 2 + Timeout: 60 + MaxParallel: 3 EnvVars: AZURE_TEST_MODE: LIVE Artifacts: diff --git a/sdk/servicebus/azure-messaging-servicebus/README.md b/sdk/servicebus/azure-messaging-servicebus/README.md index 8d7f7f5bd129..e061bfd600c4 100644 --- a/sdk/servicebus/azure-messaging-servicebus/README.md +++ b/sdk/servicebus/azure-messaging-servicebus/README.md @@ -15,38 +15,21 @@ have to be online at the same time. [Source code][source_code] | [API reference documentation][api_documentation] | [Product documentation][product_docs]| [Samples][sample_examples] -## Table of contents - -- [Azure Service Bus client library for Java](#azure-service-bus-client-library-for-java) - - [Table of contents](#table-of-contents) - - [Getting started](#getting-started) - - [Prerequisites](#prerequisites) - - [Include the package](#include-the-package) - - [Authenticate the client](#authenticate-the-client) - - [Key concepts](#key-concepts) - - [Examples](#examples) - - [Send messages](#send-messages) - - [Receive messages](#receive-messages) - - [Settle messages](#settle-messages) - - [Send and receive from session enabled queues or topics](#send-and-receive-from-session-enabled-queues-or-topics) - - [Troubleshooting](#troubleshooting) - - [Enable client logging](#enable-client-logging) - - [Enable AMQP transport logging](#enable-amqp-transport-logging) - - [Common exceptions](#common-exceptions) - - [Next steps](#next-steps) - - [Contributing](#contributing) - ## Getting started ### Prerequisites -- Java Development Kit (JDK) with version 8 or above +- [Java Development Kit (JDK)][java_development_kit] with version 8 or above - [Maven][maven] - Microsoft Azure subscription - You can create a free account at: https://azure.microsoft.com - Azure Service Bus instance - Step-by-step guide for [creating a Service Bus instance using Azure Portal][service_bus_create] +To quickly create the needed Service Bus resources in Azure and to receive a connection string for them, you can deploy our sample template by clicking: + +[![](http://azuredeploy.net/deploybutton.png)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-sdk-for-net%2Fmaster%2Fsdk%2Fservicebus%2FAzure.Messaging.ServiceBus%2Fassets%2Fsamples-azure-deploy.json) + ### Include the package [//]: # ({x-version-update-start;com.azure:azure-messaging-servicebus;current}) @@ -143,7 +126,11 @@ on which actual message transmission takes place. The namespace often serves as receives a copy of the message sent to the topic. ## Examples - + - [Send messages](#send-messages) + - [Receive messages](#receive-messages) + - [Settle messages](#settle-messages) + - [Send and receive from session enabled queues or topics](#send-and-receive-from-session-enabled-queues-or-topics) + - [Create a dead-letter queue Receiver](#create-a-dead-letter-queue-receiver) ### Send messages You'll need to create an asynchronous [`ServiceBusSenderAsyncClient`][ServiceBusSenderAsyncClient] or a synchronous @@ -321,6 +308,22 @@ ServiceBusReceiverAsyncClient receiver = new ServiceBusClientBuilder() .buildAsyncClient(); ``` +### Create a dead-letter queue Receiver + +Azure Service Bus queues and topic subscriptions provide a secondary sub-queue, called a dead-letter queue (DLQ). +The dead-letter queue doesn't need to be explicitly created and can't be deleted or otherwise managed independent +of the main entity. Learn more about dead-letter queue [here][dead-letter-queue]. + + +```java +ServiceBusReceiverClient receiver = new ServiceBusClientBuilder() + .connectionString("<< CONNECTION STRING FOR THE SERVICE BUS NAMESPACE >>") + .deadLetterReceiver() + .topicName("<< TOPIC NAME >>") + .subscriptionName("<< SUBSCRIPTION NAME >>") + .buildClient(); +``` + ## Troubleshooting ### Enable client logging @@ -359,7 +362,9 @@ java.util.logging.SimpleFormatter.format=[%1$tF %1$tr] %3$s %4$s: %5$s %n This is a general exception for AMQP related failures, which includes the AMQP errors as `ErrorCondition` and the context that caused this exception as `AmqpErrorContext`. `isTransient` is a boolean indicating if the exception is a -transient error or not. If true, then the request can be retried; otherwise not. +transient error or not. If a transient AMQP exception occurs, the client library retries the operation as many times +as the [AmqpRetryOptons][AmqpRetryOptons] allows. Afterwords, the operation fails and an exception is propagated back +to the user. [`AmqpErrorCondition`][AmqpErrorCondition] contains error conditions common to the AMQP protocol and used by Azure services. When an AMQP exception is thrown, examining the error condition field can inform developers as to why the AMQP @@ -373,7 +378,7 @@ The recommended way to solve the specific exception the AMQP exception represent Beyond those discussed, the Azure Service Bus client library offers support for many additional scenarios to help take advantage of the full feature set of the Azure Service Bus service. In order to help explore some of these scenarios, -check out the [samples README][samples_readme]. +the following set of sample is available [here][samples_readme]. ## Contributing @@ -384,8 +389,11 @@ Guidelines](./../../../CONTRIBUTING.md) for more information. [aad_authorization]: https://docs.microsoft.com/azure/service-bus-messaging/authenticate-application [amqp_transport_error]: https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-transport-v1.0-os.html#type-amqp-error [AmqpErrorCondition]: ../../core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/AmqpErrorCondition.java +[AmqpRetryOptons]: ../../core/azure-core-amqp/src/main/java/com/azure/core/amqp/AmqpRetryOptions.java [api_documentation]: https://aka.ms/java-docs +[dead-letter-queue]: https://docs.microsoft.com/azure/service-bus-messaging/service-bus-dead-letter-queues [deadletterqueue_docs]: https://docs.microsoft.com/azure/service-bus-messaging/service-bus-dead-letter-queues +[java_development_kit]: https://docs.microsoft.com/java/azure/jdk/?view=azure-java-stable [java_8_sdk_javadocs]: https://docs.oracle.com/javase/8/docs/api/java/util/logging/package-summary.html [logging]: https://github.com/Azure/azure-sdk-for-java/wiki/Logging-with-Azure-SDK [maven]: https://maven.apache.org/ @@ -398,7 +406,7 @@ Guidelines](./../../../CONTRIBUTING.md) for more information. [ReceiveMode]: ./src/main/java/com/azure/messaging/servicebus/models/ReceiveMode.java [RetryOptions]: ../../core/azure-core-amqp/src/main/java/com/azure/core/amqp/AmqpRetryOptions.java [sample_examples]: ./src/samples/java/com/azure/messaging/servicebus/ -[samples_readme]: ./src/samples/README.md +[samples_readme]: ./src/samples/java/com/azure/messaging/servicebus [service_bus_connection_string]: https://docs.microsoft.com/azure/service-bus-messaging/service-bus-create-namespace-portal#get-the-connection-string [servicebus_create]: https://docs.microsoft.com/azure/service-bus-messaging/service-bus-create-namespace-portal [servicebus_messaging_exceptions]: https://docs.microsoft.com/azure/service-bus-messaging/service-bus-messaging-exceptions @@ -407,6 +415,7 @@ Guidelines](./../../../CONTRIBUTING.md) for more information. [ServiceBusReceiverClient]: ./src/main/java/com/azure/messaging/servicebus/ServiceBusReceiverClient.java [ServiceBusSenderAsyncClient]: ./src/main/java/com/azure/messaging/servicebus/ServiceBusSenderAsyncClient.java [ServiceBusSenderClient]: ./src/main/java/com/azure/messaging/servicebus/ServiceBusSenderClient.java +[service_bus_create]: https://docs.microsoft.com/azure/service-bus-messaging/service-bus-create-namespace-portal [source_code]: ./ [subscription_concept]: https://docs.microsoft.com/azure/service-bus-messaging/service-bus-queues-topics-subscriptions#topics-and-subscriptions [topic_concept]: https://docs.microsoft.com/azure/service-bus-messaging/service-bus-messaging-overview#topics diff --git a/sdk/servicebus/azure-messaging-servicebus/pom.xml b/sdk/servicebus/azure-messaging-servicebus/pom.xml index d89741dde4f1..2df24f5d041b 100644 --- a/sdk/servicebus/azure-messaging-servicebus/pom.xml +++ b/sdk/servicebus/azure-messaging-servicebus/pom.xml @@ -42,7 +42,7 @@ com.azure azure-core - 1.6.0 + 1.7.0-beta.1 com.azure @@ -71,7 +71,7 @@ com.azure azure-identity - 1.0.7 + 1.0.8 test diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusAsyncConsumer.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusAsyncConsumer.java index 033f19b397ff..d0bd513da33b 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusAsyncConsumer.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusAsyncConsumer.java @@ -3,23 +3,17 @@ package com.azure.messaging.servicebus; -import com.azure.core.amqp.AmqpRetryOptions; import com.azure.core.amqp.implementation.MessageSerializer; import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.servicebus.implementation.DispositionStatus; -import com.azure.messaging.servicebus.implementation.MessageManagementOperations; import com.azure.messaging.servicebus.implementation.MessageUtils; -import com.azure.messaging.servicebus.implementation.ServiceBusMessageProcessor; import com.azure.messaging.servicebus.implementation.ServiceBusReceiveLinkProcessor; import org.apache.qpid.proton.amqp.transport.DeliveryState; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import java.time.Duration; -import java.time.Instant; import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; -import java.util.function.BiFunction; import static com.azure.core.util.FluxUtil.monoError; @@ -32,22 +26,17 @@ class ServiceBusAsyncConsumer implements AutoCloseable { private final String linkName; private final ServiceBusReceiveLinkProcessor linkProcessor; private final MessageSerializer messageSerializer; - private final ServiceBusMessageProcessor processor; + private final Flux processor; ServiceBusAsyncConsumer(String linkName, ServiceBusReceiveLinkProcessor linkProcessor, - MessageSerializer messageSerializer, boolean isAutoComplete, boolean autoLockRenewal, - Duration maxAutoLockRenewDuration, AmqpRetryOptions retryOptions, - BiFunction> renewMessageLock) { + MessageSerializer messageSerializer, int prefetch) { this.linkName = linkName; this.linkProcessor = linkProcessor; this.messageSerializer = messageSerializer; - - final MessageManagement messageManagement = new MessageManagement(linkProcessor, renewMessageLock); - this.processor = linkProcessor .map(message -> this.messageSerializer.deserialize(message, ServiceBusReceivedMessage.class)) - .subscribeWith(new ServiceBusMessageProcessor(linkName, isAutoComplete, autoLockRenewal, - maxAutoLockRenewDuration, retryOptions, linkProcessor.getErrorContext(), messageManagement)); + .publish(prefetch) + .autoConnect(1); } /** @@ -88,29 +77,7 @@ Mono updateDisposition(String lockToken, DispositionStatus dispositionStat @Override public void close() { if (!isDisposed.getAndSet(true)) { - processor.onComplete(); - linkProcessor.cancel(); - } - } - - private static final class MessageManagement implements MessageManagementOperations { - private final ServiceBusReceiveLinkProcessor link; - private final BiFunction> renewMessageLock; - - private MessageManagement(ServiceBusReceiveLinkProcessor link, - BiFunction> renewMessageLock) { - this.link = link; - this.renewMessageLock = renewMessageLock; - } - - @Override - public Mono updateDisposition(String lockToken, DeliveryState deliveryState) { - return link.updateDisposition(lockToken, deliveryState); - } - - @Override - public Mono renewMessageLock(String lockToken, String associatedLinkName) { - return renewMessageLock.apply(lockToken, associatedLinkName); + linkProcessor.dispose(); } } } diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusManagementAsyncClient.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusManagementAsyncClient.java index 28be13b846f4..b0d698269c94 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusManagementAsyncClient.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusManagementAsyncClient.java @@ -6,6 +6,7 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.AzureException; import com.azure.core.exception.ClientAuthenticationException; import com.azure.core.exception.HttpResponseException; import com.azure.core.exception.ResourceExistsException; @@ -31,6 +32,7 @@ import com.azure.messaging.servicebus.implementation.models.CreateSubscriptionBodyContent; import com.azure.messaging.servicebus.implementation.models.CreateTopicBody; import com.azure.messaging.servicebus.implementation.models.CreateTopicBodyContent; +import com.azure.messaging.servicebus.implementation.models.NamespacePropertiesEntry; import com.azure.messaging.servicebus.implementation.models.QueueDescriptionEntry; import com.azure.messaging.servicebus.implementation.models.QueueDescriptionFeed; import com.azure.messaging.servicebus.implementation.models.ResponseLink; @@ -40,6 +42,7 @@ import com.azure.messaging.servicebus.implementation.models.SubscriptionDescriptionFeed; import com.azure.messaging.servicebus.implementation.models.TopicDescriptionEntry; import com.azure.messaging.servicebus.implementation.models.TopicDescriptionFeed; +import com.azure.messaging.servicebus.models.NamespaceProperties; import com.azure.messaging.servicebus.models.QueueDescription; import com.azure.messaging.servicebus.models.QueueRuntimeInfo; import com.azure.messaging.servicebus.models.SubscriptionDescription; @@ -457,6 +460,40 @@ public Mono> getQueueWithResponse(String queueName) { return withContext(context -> getQueueWithResponse(queueName, context, Function.identity())); } + /** + * Gets whether or not a queue with {@code queueName} exists in the Service Bus namespace. + * + * @param queueName Name of the queue. + * + * @return A Mono that completes indicating whether or not the queue exists. + * @throws ClientAuthenticationException if the client's credentials do not have access to modify the + * namespace. + * @throws HttpResponseException If error occurred processing the request. + * @throws IllegalArgumentException if {@code queueName} is an empty string. + * @throws NullPointerException if {@code queueName} is null. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getQueueExists(String queueName) { + return getQueueExistsWithResponse(queueName).map(Response::getValue); + } + + /** + * Gets whether or not a queue with {@code queueName} exists in the Service Bus namespace. + * + * @param queueName Name of the queue. + * + * @return A Mono that completes indicating whether or not the queue exists along with its HTTP response. + * @throws ClientAuthenticationException if the client's credentials do not have access to modify the + * namespace. + * @throws HttpResponseException If error occurred processing the request. + * @throws IllegalArgumentException if {@code queueName} is an empty string. + * @throws NullPointerException if {@code queueName} is null. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getQueueExistsWithResponse(String queueName) { + return getEntityExistsWithResponse(getQueueWithResponse(queueName)); + } + /** * Gets runtime information about the queue. * @@ -495,6 +532,31 @@ public Mono> getQueueRuntimeInfoWithResponse(String q return withContext(context -> getQueueWithResponse(queueName, context, QueueRuntimeInfo::new)); } + /** + * Gets information about the Service Bus namespace. + * + * @return A Mono that completes with information about the Service Bus namespace. + * @throws ClientAuthenticationException if the client's credentials do not have access to the namespace. + * @throws HttpResponseException If error occurred processing the request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getNamespaceProperties() { + return getNamespacePropertiesWithResponse().map(Response::getValue); + } + + /** + * Gets information about the Service Bus namespace along with its HTTP response. + * + * @return A Mono that completes with information about the namespace and the associated HTTP response. + * @throws ClientAuthenticationException if the client's credentials do not have access to modify the + * namespace. + * @throws HttpResponseException If error occurred processing the request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNamespacePropertiesWithResponse() { + return withContext(this::getNamespacePropertiesWithResponse); + } + /** * Gets information about the queue. * @@ -537,6 +599,42 @@ public Mono> getSubscriptionWithResponse(Strin Function.identity())); } + /** + * Gets whether or not a subscription within a topic exists. + * + * @param topicName Name of topic associated with subscription. + * @param subscriptionName Name of the subscription. + * + * @return A Mono that completes indicating whether or not the subscription exists. + * @throws ClientAuthenticationException if the client's credentials do not have access to modify the + * namespace. + * @throws HttpResponseException If error occurred processing the request. + * @throws IllegalArgumentException if {@code subscriptionName} is an empty string. + * @throws NullPointerException if {@code subscriptionName} is null. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getSubscriptionExists(String topicName, String subscriptionName) { + return getSubscriptionExistsWithResponse(topicName, subscriptionName).map(Response::getValue); + } + + /** + * Gets whether or not a subscription within a topic exists. + * + * @param topicName Name of topic associated with subscription. + * @param subscriptionName Name of the subscription. + * + * @return A Mono that completes indicating whether or not the subscription exists along with its HTTP response. + * @throws ClientAuthenticationException if the client's credentials do not have access to modify the + * namespace. + * @throws HttpResponseException If error occurred processing the request. + * @throws IllegalArgumentException if {@code subscriptionName} is an empty string. + * @throws NullPointerException if {@code subscriptionName} is null. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getSubscriptionExistsWithResponse(String topicName, String subscriptionName) { + return getEntityExistsWithResponse(getSubscriptionWithResponse(topicName, subscriptionName)); + } + /** * Gets runtime information about the subscription. * @@ -619,6 +717,40 @@ public Mono> getTopicWithResponse(String topicName) { return withContext(context -> getTopicWithResponse(topicName, context, Function.identity())); } + /** + * Gets whether or not a topic with {@code topicName} exists in the Service Bus namespace. + * + * @param topicName Name of the topic. + * + * @return A Mono that completes indicating whether or not the topic exists. + * @throws ClientAuthenticationException if the client's credentials do not have access to modify the + * namespace. + * @throws HttpResponseException If error occurred processing the request. + * @throws IllegalArgumentException if {@code topicName} is an empty string. + * @throws NullPointerException if {@code topicName} is null. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getTopicExists(String topicName) { + return getTopicExistsWithResponse(topicName).map(Response::getValue); + } + + /** + * Gets whether or not a topic with {@code topicName} exists in the Service Bus namespace. + * + * @param topicName Name of the topic. + * + * @return A Mono that completes indicating whether or not the topic exists along with its HTTP response. + * @throws ClientAuthenticationException if the client's credentials do not have access to modify the + * namespace. + * @throws HttpResponseException If error occurred processing the request. + * @throws IllegalArgumentException if {@code topicName} is an empty string. + * @throws NullPointerException if {@code topicName} is null. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTopicExistsWithResponse(String topicName) { + return getEntityExistsWithResponse(getTopicWithResponse(topicName)); + } + /** * Gets runtime information about the topic. * @@ -1135,6 +1267,31 @@ Mono> deleteTopicWithResponse(String topicName, Context context) } } + /** + * Gets whether an entity exists. + * + * @param getEntityOperation Operation to get information about entity. If {@link ResourceNotFoundException} is + * thrown, then it is mapped to false. + * @param Entity type. + * + * @return True if the entity exists, false otherwise. + */ + Mono> getEntityExistsWithResponse(Mono> getEntityOperation) { + return getEntityOperation.map(response -> { + // When an entity does not exist, it does not have any description object in it. + final boolean exists = response.getValue() != null; + return (Response) new SimpleResponse<>(response.getRequest(), response.getStatusCode(), + response.getHeaders(), exists); + }) + .onErrorResume(ResourceNotFoundException.class, exception -> { + final HttpResponse response = exception.getResponse(); + final Response result = new SimpleResponse<>(response.getRequest(), response.getStatusCode(), + response.getHeaders(), false); + + return Mono.just(result); + }); + } + /** * Gets a queue with its context. * @@ -1226,6 +1383,30 @@ Mono> getSubscriptionWithResponse(String topicName, String subsc } } + /** + * Gets the namespace properties with its context. + * + * @param context Context to pass into request. + * + * @return A Mono that completes with the {@link NamespaceProperties}. + */ + Mono> getNamespacePropertiesWithResponse(Context context) { + return managementClient.getNamespaces().getWithResponseAsync(context).handle((response, sink) -> { + final NamespacePropertiesEntry entry = response.getValue(); + if (entry == null || entry.getContent() == null) { + sink.error(new AzureException( + "There was no content inside namespace response. Entry: " + response)); + return; + } + + final NamespaceProperties namespaceProperties = entry.getContent().getNamespaceProperties(); + final Response result = new SimpleResponse<>(response.getRequest(), + response.getStatusCode(), response.getHeaders(), namespaceProperties); + + sink.next(result); + }); + } + /** * Gets a topic with its context. * @@ -1541,7 +1722,7 @@ private Response deserializeQueue(Response response) { if (entry == null) { return new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), null); } else if (entry.getContent() == null) { - logger.info("entry.getContent() is null. There should have been content returned. Entry: {}", entry); + logger.info("entry.getContent() is null. The entity may not exist. {}", entry); return new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), null); } diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusManagementClient.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusManagementClient.java index da1e5096a471..bfd9dcea008f 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusManagementClient.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusManagementClient.java @@ -14,12 +14,14 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; +import com.azure.messaging.servicebus.models.NamespaceProperties; import com.azure.messaging.servicebus.models.QueueDescription; import com.azure.messaging.servicebus.models.QueueRuntimeInfo; import com.azure.messaging.servicebus.models.SubscriptionDescription; import com.azure.messaging.servicebus.models.SubscriptionRuntimeInfo; import com.azure.messaging.servicebus.models.TopicDescription; import com.azure.messaging.servicebus.models.TopicRuntimeInfo; +import reactor.core.publisher.Mono; import java.time.Duration; import java.util.Objects; @@ -382,7 +384,46 @@ public QueueDescription getQueue(String queueName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getQueueWithResponse(String queueName, Context context) { - return asyncClient.getQueueWithResponse(queueName, context, Function.identity()).block(); + return asyncClient.getQueueWithResponse(queueName, context != null ? context : Context.NONE, + Function.identity()).block(); + } + + /** + * Gets whether or not a queue with {@code queueName} exists in the Service Bus namespace. + * + * @param queueName Name of the queue. + * + * @return {@code true} if the queue exists; otherwise {@code false}. + * @throws ClientAuthenticationException if the client's credentials do not have access to modify the + * namespace. + * @throws HttpResponseException If error occurred processing the request. + * @throws IllegalArgumentException if {@code queueName} is an empty string. + * @throws NullPointerException if {@code queueName} is null. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public boolean getQueueExists(String queueName) { + final Boolean exists = asyncClient.getQueueExists(queueName).block(); + return exists != null && exists; + } + + /** + * Gets whether or not a queue with {@code queueName} exists in the Service Bus namespace. + * + * @param queueName Name of the queue. + * @param context Additional context that is passed through the HTTP pipeline during the service call. + * + * @return The HTTP response and {@code true} if the queue exists; otherwise {@code false}. + * @throws ClientAuthenticationException if the client's credentials do not have access to modify the + * namespace. + * @throws HttpResponseException If error occurred processing the request. + * @throws IllegalArgumentException if {@code queueName} is an empty string. + * @throws NullPointerException if {@code queueName} is null. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getQueueExistsWithResponse(String queueName, Context context) { + final Mono> queueWithResponse = + asyncClient.getQueueWithResponse(queueName, context != null ? context : Context.NONE, Function.identity()); + return asyncClient.getEntityExistsWithResponse(queueWithResponse).block(); } /** @@ -421,7 +462,35 @@ public QueueRuntimeInfo getQueueRuntimeInfo(String queueName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getQueueRuntimeInfoWithResponse(String queueName, Context context) { - return asyncClient.getQueueWithResponse(queueName, context, QueueRuntimeInfo::new).block(); + return asyncClient.getQueueWithResponse(queueName, context != null ? context : Context.NONE, + QueueRuntimeInfo::new).block(); + } + + /** + * Gets information about the Service Bus namespace. + * + * @return A Mono that completes with information about the Service Bus namespace. + * @throws ClientAuthenticationException if the client's credentials do not have access to the namespace. + * @throws HttpResponseException If error occurred processing the request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NamespaceProperties getNamespaceProperties() { + return asyncClient.getNamespaceProperties().block(); + } + + /** + * Gets information about the Service Bus namespace along with its HTTP response. + * + * @param context Additional context that is passed through the HTTP pipeline during the service call. + * + * @return A Mono that completes with information about the namespace and the associated HTTP response. + * @throws ClientAuthenticationException if the client's credentials do not have access to modify the + * namespace. + * @throws HttpResponseException If error occurred processing the request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNamespacePropertiesWithResponse(Context context) { + return asyncClient.getNamespacePropertiesWithResponse(context).block(); } /** @@ -463,8 +532,50 @@ public SubscriptionDescription getSubscription(String topicName, String subscrip @ServiceMethod(returns = ReturnType.SINGLE) public Response getSubscriptionWithResponse(String topicName, String subscriptionName, Context context) { - return asyncClient.getSubscriptionWithResponse(topicName, subscriptionName, context, - Function.identity()).block(); + return asyncClient.getSubscriptionWithResponse(topicName, subscriptionName, + context != null ? context : Context.NONE, Function.identity()).block(); + } + + /** + * Gets whether or not a subscription within a topic exists. + * + * @param topicName Name of topic associated with subscription. + * @param subscriptionName Name of the subscription. + * + * @return {@code true} if the subscription exists. + * @throws ClientAuthenticationException if the client's credentials do not have access to modify the + * namespace. + * @throws HttpResponseException If error occurred processing the request. + * @throws IllegalArgumentException if {@code subscriptionName} is an empty string. + * @throws NullPointerException if {@code subscriptionName} is null. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public boolean getSubscriptionExists(String topicName, String subscriptionName) { + final Boolean exists = asyncClient.getSubscriptionExists(topicName, subscriptionName).block(); + return exists != null && exists; + } + + /** + * Gets whether or not a subscription within a topic exists. + * + * @param topicName Name of topic associated with subscription. + * @param subscriptionName Name of the subscription. + * @param context Additional context that is passed through the HTTP pipeline during the service call. + * + * @return The HTTP response and {@code true} if the subscription exists; otherwise {@code false}. + * @throws ClientAuthenticationException if the client's credentials do not have access to modify the + * namespace. + * @throws HttpResponseException If error occurred processing the request. + * @throws IllegalArgumentException if {@code subscriptionName} is an empty string. + * @throws NullPointerException if {@code subscriptionName} is null. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSubscriptionExistsWithResponse(String topicName, String subscriptionName, + Context context) { + final Mono> subscriptionWithResponse = + asyncClient.getSubscriptionWithResponse(topicName, subscriptionName, + context != null ? context : Context.NONE, Function.identity()); + return asyncClient.getEntityExistsWithResponse(subscriptionWithResponse).block(); } /** @@ -506,8 +617,8 @@ public SubscriptionRuntimeInfo getSubscriptionRuntimeInfo(String topicName, Stri @ServiceMethod(returns = ReturnType.SINGLE) public Response getSubscriptionRuntimeInfoWithResponse(String topicName, String subscriptionName, Context context) { - return asyncClient.getSubscriptionWithResponse(topicName, subscriptionName, context, - SubscriptionRuntimeInfo::new).block(); + return asyncClient.getSubscriptionWithResponse(topicName, subscriptionName, + context != null ? context : Context.NONE, SubscriptionRuntimeInfo::new).block(); } /** @@ -546,7 +657,46 @@ public TopicDescription getTopic(String topicName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getTopicWithResponse(String topicName, Context context) { - return asyncClient.getTopicWithResponse(topicName, context, Function.identity()).block(); + return asyncClient.getTopicWithResponse(topicName, context != null ? context : Context.NONE, + Function.identity()).block(); + } + + /** + * Gets whether or not a topic with {@code topicName} exists in the Service Bus namespace. + * + * @param topicName Name of the topic. + * + * @return {@code true} if the topic exists. + * @throws ClientAuthenticationException if the client's credentials do not have access to modify the + * namespace. + * @throws HttpResponseException If error occurred processing the request. + * @throws IllegalArgumentException if {@code topicName} is an empty string. + * @throws NullPointerException if {@code topicName} is null. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public boolean getTopicExists(String topicName) { + final Boolean exists = asyncClient.getTopicExists(topicName).block(); + return exists != null && exists; + } + + /** + * Gets whether or not a topic with {@code topicName} exists in the Service Bus namespace. + * + * @param topicName Name of the topic. + * @param context Additional context that is passed through the HTTP pipeline during the service call. + * + * @return The HTTP response and {@code true} if the topic exists; otherwise {@code false}. + * @throws ClientAuthenticationException if the client's credentials do not have access to modify the + * namespace. + * @throws HttpResponseException If error occurred processing the request. + * @throws IllegalArgumentException if {@code topicName} is an empty string. + * @throws NullPointerException if {@code topicName} is null. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTopicExistsWithResponse(String topicName, Context context) { + final Mono> topicWithResponse = + asyncClient.getTopicWithResponse(topicName, context != null ? context : Context.NONE, Function.identity()); + return asyncClient.getEntityExistsWithResponse(topicWithResponse).block(); } /** @@ -585,7 +735,8 @@ public TopicRuntimeInfo getTopicRuntimeInfo(String topicName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getTopicRuntimeInfoWithResponse(String topicName, Context context) { - return asyncClient.getTopicWithResponse(topicName, context, TopicRuntimeInfo::new).block(); + return asyncClient.getTopicWithResponse(topicName, context != null ? context : Context.NONE, + TopicRuntimeInfo::new).block(); } /** diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClient.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClient.java index b75f2e01523f..164f8fcae3f4 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClient.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClient.java @@ -6,7 +6,6 @@ import com.azure.core.amqp.AmqpRetryPolicy; import com.azure.core.amqp.AmqpTransaction; import com.azure.core.amqp.exception.AmqpException; -import com.azure.core.amqp.exception.LinkErrorContext; import com.azure.core.amqp.implementation.MessageSerializer; import com.azure.core.amqp.implementation.RetryUtil; import com.azure.core.amqp.implementation.StringUtil; @@ -56,10 +55,6 @@ * other terminal scenarios. See {@link #receiveMessages()} for more information.

* {@codesnippet com.azure.messaging.servicebus.servicebusasyncreceiverclient.receive#all} * - *

Receive a maximum number of messages or until max a Duration

- *

This receives at most 15 messages, or until a duration of 30 seconds elapses. Whichever occurs first.

- * {@codesnippet com.azure.messaging.servicebus.servicebusasyncreceiverclient.receive#int-duration} - * *

Receive messages in {@link ReceiveMode#RECEIVE_AND_DELETE} mode from Service Bus resource

* {@codesnippet com.azure.messaging.servicebus.servicebusasyncreceiverclient.receiveWithReceiveAndDeleteMode} * @@ -886,30 +881,6 @@ public Flux receiveMessages() { } } - /** - * Receives a bounded stream of {@link ServiceBusReceivedMessage messages} from the Service Bus entity. This stream - * receives either {@code maxNumberOfMessages} are received or the {@code maxWaitTime} has elapsed. - * - * @param maxNumberOfMessages Maximum number of messages to receive. - * @param maxWaitTime Maximum time to wait. - * - * @return A bounded {@link Flux} of messages. - * @throws NullPointerException if {@code maxWaitTime} is null. - * @throws IllegalArgumentException if {@code maxNumberOfMessages} is less than 1. {@code maxWaitTime} is zero - * or a negative duration. - */ - public Flux receiveMessages(int maxNumberOfMessages, Duration maxWaitTime) { - if (maxNumberOfMessages < 1) { - return fluxError(logger, new IllegalArgumentException("'maxNumberOfMessages' cannot be less than 1.")); - } else if (maxWaitTime == null) { - return fluxError(logger, new NullPointerException("'maxWaitTime' cannot be null.")); - } else if (maxWaitTime.isNegative() || maxWaitTime.isZero()) { - return fluxError(logger, new NullPointerException("'maxWaitTime' cannot be negative or zero.")); - } - - return receiveMessages().take(maxNumberOfMessages).take(maxWaitTime); - } - /** * Receives a deferred {@link ServiceBusReceivedMessage message}. Deferred messages can only be received by using * sequence number. @@ -1283,16 +1254,12 @@ private ServiceBusAsyncConsumer getOrCreateConsumer() { }) .repeat(); - final LinkErrorContext context = new LinkErrorContext(fullyQualifiedNamespace, entityPath, linkName, - null); final AmqpRetryPolicy retryPolicy = RetryUtil.getRetryPolicy(connectionProcessor.getRetryOptions()); final ServiceBusReceiveLinkProcessor linkMessageProcessor = receiveLink.subscribeWith( - new ServiceBusReceiveLinkProcessor(receiverOptions.getPrefetchCount(), retryPolicy, connectionProcessor, - context)); + new ServiceBusReceiveLinkProcessor(receiverOptions.getPrefetchCount(), retryPolicy, + receiverOptions.getReceiveMode())); final ServiceBusAsyncConsumer newConsumer = new ServiceBusAsyncConsumer(linkName, linkMessageProcessor, - messageSerializer, false, receiverOptions.autoLockRenewalEnabled(), - receiverOptions.getMaxAutoLockRenewalDuration(), connectionProcessor.getRetryOptions(), - (token, associatedLinkName) -> renewMessageLock(token, associatedLinkName)); + messageSerializer, receiverOptions.getPrefetchCount()); // There could have been multiple threads trying to create this async consumer when the result was null. // If another one had set the value while we were creating this resource, dispose of newConsumer. @@ -1311,16 +1278,6 @@ ReceiverOptions getReceiverOptions() { return receiverOptions; } - /** - * Renews the message lock, and updates its value in the container. - */ - private Mono renewMessageLock(String lockToken, String linkName) { - return connectionProcessor - .flatMap(connection -> connection.getManagementNode(entityPath, entityType)) - .flatMap(serviceBusManagementNode -> - serviceBusManagementNode.renewMessageLock(lockToken, linkName)); - } - /** * If the receiver has not connected via {@link #receiveMessages()}, all its current operations have been performed * through the management node. diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/UnnamedSessionReceiver.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/UnnamedSessionReceiver.java index 5166b252999c..a141e9621a08 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/UnnamedSessionReceiver.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/UnnamedSessionReceiver.java @@ -3,8 +3,6 @@ package com.azure.messaging.servicebus; import com.azure.core.amqp.AmqpRetryOptions; -import com.azure.core.amqp.exception.AmqpErrorContext; -import com.azure.core.amqp.exception.LinkErrorContext; import com.azure.core.amqp.implementation.MessageSerializer; import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; @@ -12,7 +10,6 @@ import com.azure.messaging.servicebus.implementation.MessageManagementOperations; import com.azure.messaging.servicebus.implementation.MessageUtils; import com.azure.messaging.servicebus.implementation.ServiceBusConstants; -import com.azure.messaging.servicebus.implementation.ServiceBusMessageProcessor; import com.azure.messaging.servicebus.implementation.ServiceBusReceiveLink; import org.apache.qpid.proton.amqp.transport.DeliveryState; import reactor.core.Disposable; @@ -75,10 +72,6 @@ class UnnamedSessionReceiver implements AutoCloseable { this.renewSessionLock = renewSessionLock; this.lockContainer = new MessageLockContainer(ServiceBusConstants.OPERATION_TIMEOUT); - final AmqpErrorContext errorContext = new LinkErrorContext(receiveLink.getHostname(), - receiveLink.getEntityPath(), null, null); - final SessionMessageManagement messageManagement = new SessionMessageManagement(receiveLink); - receiveLink.setEmptyCreditListener(() -> 1); final Flux receivedMessagesFlux = receiveLink @@ -89,15 +82,19 @@ class UnnamedSessionReceiver implements AutoCloseable { receiveLink.addCredits(prefetch); }) .takeUntilOther(cancelReceiveProcessor) - .map(message -> messageSerializer.deserialize(message, ServiceBusReceivedMessage.class)) - .subscribeWith(new ServiceBusMessageProcessor(receiveLink.getLinkName(), false, false, - Duration.ZERO, retryOptions, errorContext, messageManagement)) .map(message -> { - if (!CoreUtils.isNullOrEmpty(message.getLockToken())) { - lockContainer.addOrUpdate(message.getLockToken(), message.getLockedUntil()); + final ServiceBusReceivedMessage deserialized = messageSerializer.deserialize(message, + ServiceBusReceivedMessage.class); + + //TODO (conniey): For session receivers, do they have a message lock token? + if (!CoreUtils.isNullOrEmpty(deserialized.getLockToken())) { + lockContainer.addOrUpdate(deserialized.getLockToken(), deserialized.getLockedUntil()); + } else { + logger.info("sessionId[{}] message[{}]. There is no lock token.", + deserialized.getSessionId(), deserialized.getMessageId()); } - return new ServiceBusReceivedMessageContext(message); + return new ServiceBusReceivedMessageContext(deserialized); }) .onErrorResume(error -> { logger.warning("sessionId[{}]. Error occurred. Ending session.", sessionId, error); @@ -108,9 +105,12 @@ class UnnamedSessionReceiver implements AutoCloseable { return; } - final String token = CoreUtils.isNullOrEmpty(context.getMessage().getLockToken()) - ? context.getMessage().getLockToken() + final ServiceBusReceivedMessage message = context.getMessage(); + final String token = !CoreUtils.isNullOrEmpty(message.getLockToken()) + ? message.getLockToken() : ""; + + logger.verbose("Received sessionId[{}] messageId[{}]", context.getSessionId(), message.getMessageId()); messageReceivedSink.next(token); }); diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusManagementSerializer.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusManagementSerializer.java index 883a11d1db3d..33910011c782 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusManagementSerializer.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusManagementSerializer.java @@ -9,7 +9,6 @@ import com.azure.core.util.serializer.JacksonAdapter; import com.azure.core.util.serializer.SerializerAdapter; import com.azure.core.util.serializer.SerializerEncoding; -import com.azure.messaging.servicebus.implementation.models.ServiceBusManagementError; import java.io.IOException; import java.lang.reflect.Type; @@ -66,12 +65,11 @@ public T deserialize(String value, Type type, SerializerEncoding encoding) t return jacksonAdapter.deserialize(value, type, encoding); } - if (ServiceBusManagementError.class == type) { - final ServiceBusManagementError error = deserialize(value, type); - return (T) error; + if (Object.class == type) { + return (T) value; + } else { + return (T) deserialize(value, type); } - - return (T) value; } @Override diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusMessageProcessor.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusMessageProcessor.java deleted file mode 100644 index fdff1753338e..000000000000 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusMessageProcessor.java +++ /dev/null @@ -1,457 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.messaging.servicebus.implementation; - -import com.azure.core.amqp.AmqpRetryOptions; -import com.azure.core.amqp.exception.AmqpErrorCondition; -import com.azure.core.amqp.exception.AmqpErrorContext; -import com.azure.core.amqp.exception.AmqpException; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import com.azure.messaging.servicebus.ServiceBusReceivedMessage; -import org.apache.qpid.proton.amqp.transport.DeliveryState; -import org.reactivestreams.Subscription; -import reactor.core.CoreSubscriber; -import reactor.core.Disposable; -import reactor.core.Disposables; -import reactor.core.Exceptions; -import reactor.core.publisher.EmitterProcessor; -import reactor.core.publisher.Flux; -import reactor.core.publisher.FluxProcessor; -import reactor.core.publisher.FluxSink; -import reactor.core.publisher.Mono; -import reactor.core.publisher.Operators; -import reactor.util.context.Context; - -import java.time.Duration; -import java.time.Instant; -import java.util.Deque; -import java.util.Objects; -import java.util.concurrent.ConcurrentLinkedDeque; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; -import java.util.concurrent.atomic.AtomicLongFieldUpdater; -import java.util.concurrent.atomic.AtomicReferenceFieldUpdater; - -/** - * Processor that listens to upstream messages, pushes them downstream then completes it if necessary. - */ -public class ServiceBusMessageProcessor extends FluxProcessor - implements Subscription { - private final ClientLogger logger = new ClientLogger(ServiceBusMessageProcessor.class); - private final boolean isAutoComplete; - private final String linkName; - private final AmqpRetryOptions retryOptions; - private final AmqpErrorContext errorContext; - private final Deque messageQueue = new ConcurrentLinkedDeque<>(); - private final boolean isAutoRenewLock; - private final Duration maxAutoLockRenewal; - private final MessageManagementOperations managementOperations; - - public ServiceBusMessageProcessor(String linkName, boolean isAutoComplete, boolean isAutoRenewLock, - Duration maxAutoLockRenewal, AmqpRetryOptions retryOptions, AmqpErrorContext errorContext, - MessageManagementOperations managementOperations) { - - super(); - this.linkName = linkName; - - this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); - this.errorContext = Objects.requireNonNull(errorContext, "'errorContext' cannot be null."); - this.managementOperations = managementOperations; - - this.isAutoComplete = isAutoComplete; - this.isAutoRenewLock = isAutoRenewLock; - this.maxAutoLockRenewal = maxAutoLockRenewal; - } - - private volatile boolean isDone; - private volatile CoreSubscriber downstream; - private volatile boolean isCancelled; - - volatile Subscription upstream; - private static final AtomicReferenceFieldUpdater UPSTREAM = - AtomicReferenceFieldUpdater.newUpdater(ServiceBusMessageProcessor.class, Subscription.class, - "upstream"); - - volatile int once; - static final AtomicIntegerFieldUpdater ONCE = - AtomicIntegerFieldUpdater.newUpdater(ServiceBusMessageProcessor.class, "once"); - - volatile int wip; - static final AtomicIntegerFieldUpdater WIP = - AtomicIntegerFieldUpdater.newUpdater(ServiceBusMessageProcessor.class, "wip"); - - volatile long requested; - static final AtomicLongFieldUpdater REQUESTED = - AtomicLongFieldUpdater.newUpdater(ServiceBusMessageProcessor.class, "requested"); - - volatile Throwable error; - static final AtomicReferenceFieldUpdater ERROR = - AtomicReferenceFieldUpdater.newUpdater(ServiceBusMessageProcessor.class, Throwable.class, "error"); - - /** - * Invoked when this subscribes to an upstream publisher. - * - * @param subscription Subscription for the upstream publisher. - */ - @Override - public void onSubscribe(Subscription subscription) { - Objects.requireNonNull(subscription, "'subscription' cannot be null."); - - if (Operators.setOnce(UPSTREAM, this, subscription)) { - subscription.request(1); - } else { - final Throwable error = logger.logExceptionAsError(new IllegalStateException( - "Processor cannot be subscribed to with multiple upstreams.")); - - onError(Operators.onOperatorError(subscription, error, Context.empty())); - } - } - - @Override - public boolean isTerminated() { - return isDone || isCancelled; - } - - @Override - public void onNext(ServiceBusReceivedMessage message) { - if (isTerminated()) { - final Context context = downstream == null ? currentContext() : downstream.currentContext(); - Operators.onNextDropped(message, context); - - return; - } - - messageQueue.add(message); - drain(); - } - - /** - * Invoked when an error occurs upstream. - * - * @param throwable Error that occurred upstream. - */ - @Override - public void onError(Throwable throwable) { - if (isDone || isCancelled) { - logger.error("Exception occurred from upstream when this is already terminated.", throwable); - Operators.onErrorDropped(throwable, currentContext()); - return; - } - - if (Exceptions.addThrowable(ERROR, this, throwable)) { - isDone = true; - } else { - Operators.onErrorDropped(throwable, currentContext()); - } - - drain(); - } - - /** - * Invoked when upstream has finished emitting items. - */ - @Override - public void onComplete() { - if (isDone) { - return; - } - - isDone = true; - drain(); - } - - @Override - public void request(long request) { - logger.info("Back-pressure request: {}", request); - if (Operators.validate(request)) { - Operators.addCap(REQUESTED, this, request); - - if (upstream != null) { - upstream.request(request); - } - - drain(); - } - } - - @Override - public void cancel() { - if (isCancelled) { - return; - } - - logger.verbose("Cancelling subscription."); - isCancelled = true; - drain(); - } - - @Override - public void dispose() { - if (isDone) { - return; - } - - logger.verbose("Disposing subscription."); - isDone = true; - drain(); - } - - @Override - public boolean isDisposed() { - return isDone || isCancelled; - } - - @Override - public void subscribe(CoreSubscriber downstream) { - Objects.requireNonNull(downstream, "'downstream' cannot be null."); - if (once == 0 && ONCE.compareAndSet(this, 0, 1)) { - this.downstream = downstream; - downstream.onSubscribe(this); - if (isCancelled) { - this.downstream = null; - } else { - drain(); - } - } else { - Operators.error(downstream, - new IllegalStateException("ServiceBusMessageSubscriber can only have one subscriber.")); - } - } - - private void drain() { - // If someone is already in this loop, then we are already clearing the queue. - if (!WIP.compareAndSet(this, 0, 1)) { - return; - } - - try { - drainQueue(); - } finally { - if (WIP.decrementAndGet(this) != 0) { - logger.warning("There is another worker in drainLoop. But there should only be 1 worker."); - } - } - } - - private void drainQueue() { - if (downstream == null) { - return; - } - - while (true) { - if (messageQueue.isEmpty()) { - break; - } - - long amountRequested = REQUESTED.get(this); - long emitted = drainRequested(amountRequested); - - // We emitted the correct number that was requested. - // Nothing more requested since. - if (REQUESTED.addAndGet(this, -emitted) == 0) { - break; - } - - if (isDone) { - break; - } - } - - if (isDone) { - if (error != null) { - downstream.onError(error); - } else if (messageQueue.peekLast() == null) { - downstream.onComplete(); - } else { - Operators.onDiscardQueueWithClear(messageQueue, downstream.currentContext(), null); - } - - downstream = null; - } - } - - /** - * Drains the queue of the requested amount and returns the number taken. - * - * @param numberRequested Number of items requested. - * - * @return The number of items emitted. - */ - private long drainRequested(long numberRequested) { - long numberEmitted = 0L; - - if (numberRequested == 0L) { - return numberEmitted; - } - - for (; numberEmitted < numberRequested; numberEmitted++) { - if (isDone) { - return numberEmitted; - } - - final ServiceBusReceivedMessage message = messageQueue.poll(); - if (message == null) { - break; - } - - if (isCancelled) { - Operators.onDiscard(message, downstream.currentContext()); - Operators.onDiscardQueueWithClear(messageQueue, downstream.currentContext(), null); - break; - } - - try { - next(message); - } catch (Exception e) { - setInternalError(e); - break; - } - } - - return numberEmitted; - } - - private void next(ServiceBusReceivedMessage message) { - final long sequenceNumber = message.getSequenceNumber(); - final String lockToken = message.getLockToken(); - final Instant initialLockedUntil = message.getLockedUntil(); - - if (isAutoComplete && CoreUtils.isNullOrEmpty(lockToken)) { - throw logger.logExceptionAsError(new IllegalStateException( - "Cannot auto-complete message without a lock token on message. Sequence number: " + sequenceNumber)); - } - - final AtomicBoolean hasError = new AtomicBoolean(); - final Disposable renewLockOperation = getRenewLockOperation(message, initialLockedUntil, hasError); - - try { - downstream.onNext(message); - } catch (Exception e) { - hasError.set(true); - logger.error("Exception occurred while handling downstream onNext operation.", e); - - if (isAutoComplete) { - logger.info("Abandoning message lock: {}", lockToken); - - final DeliveryState deliveryState = MessageUtils.getDeliveryState(DispositionStatus.ABANDONED, - null, null, null, null); - - managementOperations.updateDisposition(lockToken, deliveryState) - .onErrorContinue((error, item) -> { - logger.warning("Could not abandon message with lock: {}", lockToken, error); - setInternalError(error); - }) - .doFinally(signal -> logger.info("lock[{}]. Abandon status: [{}]", lockToken, signal)) - .block(retryOptions.getTryTimeout()); - } else { - setInternalError(e); - } - } finally { - renewLockOperation.dispose(); - } - - // An error occurred in downstream.onNext, while abandoning the message, - // or timed out while processing. We return. - if (hasError.get()) { - return; - } - - if (isAutoComplete) { - logger.info("sequenceNumber[{}]. lock[{}]. Completing message.", sequenceNumber, lockToken); - - final DeliveryState deliveryState = MessageUtils.getDeliveryState(DispositionStatus.COMPLETED, - null, null, null, null); - - managementOperations.updateDisposition(lockToken, deliveryState) - .onErrorResume(error -> { - logger.warning("Could not complete message with lock: {}", lockToken, error); - setInternalError(error); - return Mono.empty(); - }) - .doFinally(signal -> logger.verbose("lock[{}]. Complete status: [{}]", lockToken, signal)) - .block(retryOptions.getTryTimeout()); - } - } - - private Disposable getRenewLockOperation(ServiceBusReceivedMessage message, Instant initialLockedUntil, - AtomicBoolean hasError) { - - if (!isAutoRenewLock) { - return Disposables.disposed(); - } - - final String lockToken = message.getLockToken(); - - if (initialLockedUntil == null) { - throw logger.logExceptionAsError(new IllegalStateException( - "Cannot renew lock token without a value for 'message.getLockedUntil()'")); - } - - final Instant now = Instant.now(); - Duration initialInterval = Duration.between(now, initialLockedUntil); - if (initialInterval.isNegative()) { - logger.info("Duration was negative. now[{}] lockedUntil[{}]", now, initialLockedUntil); - initialInterval = Duration.ZERO; - } else { - final Duration adjusted = MessageUtils.adjustServerTimeout(initialInterval); - if (adjusted.isNegative()) { - logger.info("Adjusted duration is negative. Adjusted: {}ms", initialInterval.toMillis()); - } else { - initialInterval = adjusted; - } - } - - logger.info("lockToken[{}]. lockedUntil[{}]. firstInterval[{}].", lockToken, initialLockedUntil, - initialInterval); - - final EmitterProcessor emitterProcessor = EmitterProcessor.create(); - final FluxSink sink = emitterProcessor.sink(FluxSink.OverflowStrategy.BUFFER); - - // Adjust the interval, so we can buffer time for the time it'll take to refresh. - sink.next(MessageUtils.adjustServerTimeout(initialInterval)); - - final Disposable timeoutOperation = Mono.delay(maxAutoLockRenewal) - .subscribe(l -> { - if (!sink.isCancelled()) { - sink.error(new AmqpException(true, AmqpErrorCondition.TIMEOUT_ERROR, - "Could not complete within renewal time. Max renewal time: " + maxAutoLockRenewal, - errorContext)); - } - }); - - final Disposable renewLockSubscription = Flux.switchOnNext(emitterProcessor.map(i -> Flux.interval(i))) - .flatMap(delay -> { - logger.info("lockToken[{}]. now[{}]. Starting lock renewal.", lockToken, Instant.now()); - return managementOperations.renewMessageLock(lockToken, linkName); - }) - .map(instant -> { - final Duration next = Duration.between(Instant.now(), instant); - logger.info("lockToken[{}]. nextExpiration[{}]. Next renewal: [{}]", - lockToken, instant, next); - - sink.next(MessageUtils.adjustServerTimeout(next)); - return instant; - }) - .subscribe(lockedUntil -> { - logger.verbose("lockToken[{}]. lockedUntil[{}]. Lock renewal successful.", lockToken, - lockedUntil); - }, - error -> { - logger.error("Error occurred while renewing lock token.", error); - hasError.set(true); - setInternalError(error); - }, - () -> logger.info("Renewing lock token task completed.")); - - return Disposables.composite(renewLockSubscription, timeoutOperation); - } - - private void setInternalError(Throwable error) { - if (Exceptions.addThrowable(ERROR, this, error)) { - isDone = true; - } else { - Operators.onErrorDropped(error, downstream.currentContext()); - } - } -} diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusReceiveLinkProcessor.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusReceiveLinkProcessor.java index 5fecd4d570d7..98d2eddd32e9 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusReceiveLinkProcessor.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusReceiveLinkProcessor.java @@ -5,9 +5,9 @@ import com.azure.core.amqp.AmqpEndpointState; import com.azure.core.amqp.AmqpRetryPolicy; -import com.azure.core.amqp.exception.AmqpErrorContext; import com.azure.core.amqp.implementation.AmqpReceiveLink; import com.azure.core.util.logging.ClientLogger; +import com.azure.messaging.servicebus.models.ReceiveMode; import org.apache.qpid.proton.amqp.transport.DeliveryState; import org.apache.qpid.proton.message.Message; import org.reactivestreams.Subscription; @@ -42,20 +42,25 @@ public class ServiceBusReceiveLinkProcessor extends FluxProcessor messageQueue = new ConcurrentLinkedDeque<>(); - private final AtomicBoolean hasFirstLink = new AtomicBoolean(); private final AtomicBoolean linkCreditsAdded = new AtomicBoolean(); private final AtomicReference linkName = new AtomicReference<>(); + // Queue containing all the prefetched messages. + private final Deque messageQueue = new ConcurrentLinkedDeque<>(); + // size() on Deque is O(n) operation, so we use an integer to keep track. All reads and writes to this are gated by + // the `queueLock`. + private final AtomicInteger pendingMessages = new AtomicInteger(); + private final int minimumNumberOfMessages; + private final int prefetch; + private final AtomicReference> downstream = new AtomicReference<>(); private final AtomicInteger wip = new AtomicInteger(); - private final int prefetch; private final AmqpRetryPolicy retryPolicy; - private final Disposable parentConnection; - private final AmqpErrorContext errorContext; + private final ReceiveMode receiveMode; private volatile Throwable lastError; private volatile boolean isCancelled; @@ -78,39 +83,29 @@ public class ServiceBusReceiveLinkProcessor extends FluxProcessor updateDisposition(String lockToken, DeliveryState deliveryState) { if (isDisposed()) { return monoError(logger, new IllegalStateException(String.format( @@ -123,7 +118,15 @@ public Mono updateDisposition(String lockToken, DeliveryState deliveryStat "lockToken[%s]. state[%s]. Cannot update disposition with no link.", lockToken, deliveryState))); } - return link.updateDisposition(lockToken, deliveryState); + return link.updateDisposition(lockToken, deliveryState) + .then(Mono.fromRunnable(() -> { + // Check if we should add more credits. + synchronized (queueLock) { + pendingMessages.decrementAndGet(); + } + + checkAndAddCredits(link); + })); } /** @@ -196,17 +199,20 @@ public void onNext(ServiceBusReceiveLink next) { oldSubscription = currentLinkSubscriptions; currentLink = next; + next.setEmptyCreditListener(() -> { + final int creditsToAdd = getCreditsToAdd(0); + linkCreditsAdded.set(creditsToAdd > 0); - if (!hasFirstLink.getAndSet(true)) { - linkCreditsAdded.set(true); - next.addCredits(prefetch); - } - - next.setEmptyCreditListener(() -> getCreditsToAdd()); + return creditsToAdd; + }); currentLinkSubscriptions = Disposables.composite( next.receive().publishOn(Schedulers.boundedElastic()).subscribe(message -> { - messageQueue.add(message); + synchronized (queueLock) { + messageQueue.add(message); + pendingMessages.incrementAndGet(); + } + drain(); }), next.getEndpointStates().subscribe( @@ -221,9 +227,11 @@ public void onNext(ServiceBusReceiveLink next) { onError(error); }, () -> { - if (parentConnection.isDisposed() || isTerminated() - || upstream == Operators.cancelledSubscription()) { - logger.info("Terminal state reached. Disposing of link processor."); + if (isTerminated()) { + logger.info("Processor is terminated. Disposing of link processor."); + dispose(); + } else if (upstream == Operators.cancelledSubscription()) { + logger.info("Upstream has completed. Disposing of link processor."); dispose(); } else { logger.info("Receive link endpoint states are closed. Requesting another."); @@ -239,6 +247,8 @@ public void onNext(ServiceBusReceiveLink next) { })); } + checkAndAddCredits(next); + if (oldChannel != null) { oldChannel.dispose(); } @@ -313,7 +323,7 @@ public void onError(Throwable throwable) { final String linkName = link != null ? link.getLinkName() : "n/a"; final String entityPath = link != null ? link.getEntityPath() : "n/a"; - if (retryInterval != null && !parentConnection.isDisposed() && upstream != Operators.cancelledSubscription()) { + if (retryInterval != null && upstream != Operators.cancelledSubscription()) { logger.warning("linkName[{}] entityPath[{}]. Transient error occurred. Attempt: {}. Retrying after {} ms.", linkName, entityPath, attempt, retryInterval.toMillis(), throwable); @@ -322,10 +332,6 @@ public void onError(Throwable throwable) { return; } - if (parentConnection.isDisposed()) { - logger.info("Parent connection is disposed. Not reopening on error."); - } - logger.warning("linkName[{}] entityPath[{}]. Non-retryable error occurred in AMQP receive link.", linkName, entityPath, throwable); lastError = throwable; @@ -371,12 +377,11 @@ public void request(long request) { Operators.addCap(REQUESTED, this, request); final AmqpReceiveLink link = currentLink; - if (link != null && !linkCreditsAdded.getAndSet(true)) { - int credits = getCreditsToAdd(); - logger.info("Link credits not yet added. Adding: {}", credits); - link.addCredits(credits); + if (link == null) { + return; } + checkAndAddCredits(link); drain(); } @@ -469,19 +474,30 @@ private void drainQueue() { break; } - Message message = messageQueue.poll(); + final Message message = messageQueue.poll(); if (message == null) { break; } if (isCancelled) { Operators.onDiscard(message, subscriber.currentContext()); - Operators.onDiscardQueueWithClear(messageQueue, subscriber.currentContext(), null); + + synchronized (queueLock) { + Operators.onDiscardQueueWithClear(messageQueue, subscriber.currentContext(), null); + pendingMessages.set(0); + } + return; } try { subscriber.onNext(message); + + // These don't have to be settled because they're automatically settled by the link, so we + // decrement the count. + if (receiveMode != ReceiveMode.PEEK_LOCK) { + pendingMessages.decrementAndGet(); + } } catch (Exception e) { logger.error("Exception occurred while handling downstream onNext operation.", e); throw logger.logExceptionAsError(Exceptions.propagate( @@ -515,22 +531,63 @@ private boolean checkAndSetTerminated() { currentLink.dispose(); } - messageQueue.clear(); + synchronized (queueLock) { + messageQueue.clear(); + pendingMessages.set(0); + } + return true; } - private int getCreditsToAdd() { + private void checkAndAddCredits(AmqpReceiveLink link) { + if (link == null) { + return; + } + + // Credits have already been added to the link. We won't try again. + if (linkCreditsAdded.getAndSet(true)) { + return; + } + + final int credits = getCreditsToAdd(link.getCredits()); + linkCreditsAdded.set(credits > 0); + + logger.info("Link credits to add. Credits: '{}'", credits); + + if (credits > 0) { + link.addCredits(credits); + } + } + + private int getCreditsToAdd(int linkCredits) { final CoreSubscriber subscriber = downstream.get(); final long r = requested; + final boolean hasBackpressure = r != Long.MAX_VALUE; + if (subscriber == null || r == 0) { logger.info("Not adding credits. No downstream subscribers or items requested."); - linkCreditsAdded.set(false); return 0; } - linkCreditsAdded.set(true); + final int creditsToAdd; + if (messageQueue.isEmpty() && !hasBackpressure) { + creditsToAdd = prefetch; + } else { + synchronized (queueLock) { + final int queuedMessages = pendingMessages.get(); + final int pending = queuedMessages + linkCredits; + + if (hasBackpressure) { + creditsToAdd = Math.max(Long.valueOf(r).intValue() - pending, 0); + } else { + // If the queue has less than 1/3 of the prefetch, then add the difference to keep the queue full. + creditsToAdd = minimumNumberOfMessages >= queuedMessages + ? Math.max(prefetch - pending, 1) + : 0; + } + } + } - // If there is no back pressure, always add 1. Otherwise, add whatever is requested. - return r == Long.MAX_VALUE ? 1 : Long.valueOf(r).intValue(); + return creditsToAdd; } } diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/models/NamespaceProperties.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/models/NamespaceProperties.java index e6046d8031c5..6d13a2560d5b 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/models/NamespaceProperties.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/models/NamespaceProperties.java @@ -87,7 +87,7 @@ public String getAlias() { * @param alias the alias value to set. * @return the NamespaceProperties object itself. */ - public NamespaceProperties setAlias(String alias) { + NamespaceProperties setAlias(String alias) { this.alias = alias; return this; } @@ -107,7 +107,7 @@ public OffsetDateTime getCreatedTime() { * @param createdTime the createdTime value to set. * @return the NamespaceProperties object itself. */ - public NamespaceProperties setCreatedTime(OffsetDateTime createdTime) { + NamespaceProperties setCreatedTime(OffsetDateTime createdTime) { this.createdTime = createdTime; return this; } @@ -127,7 +127,7 @@ public MessagingSku getMessagingSku() { * @param messagingSku the messagingSku value to set. * @return the NamespaceProperties object itself. */ - public NamespaceProperties setMessagingSku(MessagingSku messagingSku) { + NamespaceProperties setMessagingSku(MessagingSku messagingSku) { this.messagingSku = messagingSku; return this; } @@ -147,7 +147,7 @@ public Integer getMessagingUnits() { * @param messagingUnits the messagingUnits value to set. * @return the NamespaceProperties object itself. */ - public NamespaceProperties setMessagingUnits(Integer messagingUnits) { + NamespaceProperties setMessagingUnits(Integer messagingUnits) { this.messagingUnits = messagingUnits; return this; } @@ -167,7 +167,7 @@ public OffsetDateTime getModifiedTime() { * @param modifiedTime the modifiedTime value to set. * @return the NamespaceProperties object itself. */ - public NamespaceProperties setModifiedTime(OffsetDateTime modifiedTime) { + NamespaceProperties setModifiedTime(OffsetDateTime modifiedTime) { this.modifiedTime = modifiedTime; return this; } @@ -187,7 +187,7 @@ public String getName() { * @param name the name value to set. * @return the NamespaceProperties object itself. */ - public NamespaceProperties setName(String name) { + NamespaceProperties setName(String name) { this.name = name; return this; } diff --git a/sdk/servicebus/azure-messaging-servicebus/src/samples/java/com/azure/messaging/servicebus/ReadmeSamples.java b/sdk/servicebus/azure-messaging-servicebus/src/samples/java/com/azure/messaging/servicebus/ReadmeSamples.java index e512bd9f05de..68ecda0ad74f 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/samples/java/com/azure/messaging/servicebus/ReadmeSamples.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/samples/java/com/azure/messaging/servicebus/ReadmeSamples.java @@ -192,4 +192,16 @@ public void unnamedSessionReceiver() { .queueName("<< QUEUE NAME >>") .buildAsyncClient(); } + + /** + * Code sample for creating an synchronous Service Bus receiver to read message from dead-letter queue. + */ + public void createSynchronousServiceBusDeadLetterQueueReceiver() { + ServiceBusReceiverClient receiver = new ServiceBusClientBuilder() + .connectionString("<< CONNECTION STRING FOR THE SERVICE BUS NAMESPACE >>") + .deadLetterReceiver() + .topicName("<< TOPIC NAME >>") + .subscriptionName("<< SUBSCRIPTION NAME >>") + .buildClient(); + } } diff --git a/sdk/servicebus/azure-messaging-servicebus/src/samples/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClientJavaDocCodeSamples.java b/sdk/servicebus/azure-messaging-servicebus/src/samples/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClientJavaDocCodeSamples.java index 7dde0409d038..4fa81a2c8c40 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/samples/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClientJavaDocCodeSamples.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/samples/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClientJavaDocCodeSamples.java @@ -11,7 +11,6 @@ import reactor.core.publisher.Mono; import java.util.Map; -import java.time.Duration; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; @@ -140,35 +139,6 @@ public void receiveAll() { // END: com.azure.messaging.servicebus.servicebusasyncreceiverclient.receive#all } - /** - * Receives messages up to a time or duration. - */ - public void receiveMaxTimeDuration() { - ServiceBusReceiverAsyncClient receiver = new ServiceBusClientBuilder() - .connectionString("fake-string") - .receiver() - .queueName("<< QUEUE NAME >>") - .buildAsyncClient(); - - // BEGIN: com.azure.messaging.servicebus.servicebusasyncreceiverclient.receive#int-duration - Disposable subscription = receiver.receiveMessages(15, Duration.ofSeconds(30)) - .flatMap(context -> { - ServiceBusReceivedMessage message = context.getMessage(); - System.out.printf("Received message id: %s%n", message.getMessageId()); - System.out.printf("Contents of message as string: %s%n", new String(message.getBody(), UTF_8)); - return receiver.complete(message.getLockToken()); - }).subscribe(aVoid -> System.out.println("Processed message."), - error -> System.out.println("Error occurred: " + error)); - - // subscribe is a non-blocking call and program flow will continue before messages are fetched. - // END: com.azure.messaging.servicebus.servicebusasyncreceiverclient.receive#int-duration - - // When program ends, or you're done receiving all messages. - subscription.dispose(); - - receiver.close(); - } - /** * Demonstrates how to create a session receiver for a single, first available session. */ 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 9f3b99edb4f5..aa1ae3a2c413 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 @@ -4,15 +4,13 @@ package com.azure.messaging.servicebus; import com.azure.core.amqp.AmqpEndpointState; -import com.azure.core.amqp.AmqpRetryOptions; import com.azure.core.amqp.AmqpRetryPolicy; -import com.azure.core.amqp.exception.AmqpErrorContext; import com.azure.core.amqp.implementation.MessageSerializer; import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.servicebus.implementation.ServiceBusAmqpConnection; import com.azure.messaging.servicebus.implementation.ServiceBusReceiveLink; import com.azure.messaging.servicebus.implementation.ServiceBusReceiveLinkProcessor; -import org.apache.qpid.proton.amqp.messaging.Accepted; +import com.azure.messaging.servicebus.models.ReceiveMode; import org.apache.qpid.proton.amqp.transport.DeliveryState; import org.apache.qpid.proton.message.Message; import org.junit.jupiter.api.AfterAll; @@ -24,21 +22,16 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import reactor.core.Disposable; -import reactor.core.publisher.EmitterProcessor; import reactor.core.publisher.Flux; -import reactor.core.publisher.FluxSink; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; +import reactor.test.publisher.TestPublisher; import java.time.Duration; -import java.time.Instant; import java.util.UUID; -import java.util.function.BiFunction; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; @@ -49,13 +42,14 @@ */ class ServiceBusAsyncConsumerTest { private static final String LINK_NAME = "some-link"; - private final EmitterProcessor messageProcessor = EmitterProcessor.create(); - private final FluxSink messageProcessorSink = messageProcessor.sink(); - private final EmitterProcessor endpointProcessor = EmitterProcessor.create(); - private final FluxSink endpointProcessorSink = endpointProcessor.sink(); + private final TestPublisher linkPublisher = TestPublisher.create(); + private final Flux linkFlux = linkPublisher.flux(); + private final TestPublisher messagePublisher = TestPublisher.create(); + private final Flux messageFlux = messagePublisher.flux(); + private final TestPublisher endpointPublisher = TestPublisher.create(); + private final Flux endpointStateFlux = endpointPublisher.flux(); + private final ClientLogger logger = new ClientLogger(ServiceBusAsyncConsumer.class); - private final AmqpRetryOptions retryOptions = new AmqpRetryOptions(); - private final Duration renewDuration = Duration.ofSeconds(5); private ServiceBusReceiveLinkProcessor linkProcessor; @@ -66,11 +60,7 @@ class ServiceBusAsyncConsumerTest { @Mock private AmqpRetryPolicy retryPolicy; @Mock - private Disposable parentConnection; - @Mock private MessageSerializer serializer; - @Mock - private BiFunction> renewMessageLock; @BeforeAll static void beforeAll() { @@ -88,13 +78,10 @@ void setup(TestInfo testInfo) { MockitoAnnotations.initMocks(this); - when(link.getEndpointStates()).thenReturn(endpointProcessor); - when(link.receive()).thenReturn(messageProcessor); - linkProcessor = Flux.create(sink -> sink.onRequest(requested -> { - logger.info("Requested link: {}", requested); - sink.next(link); - })).subscribeWith(new ServiceBusReceiveLinkProcessor(10, retryPolicy, parentConnection, - new AmqpErrorContext("a-namespace"))); + when(link.getEndpointStates()).thenReturn(endpointStateFlux); + when(link.receive()).thenReturn(messageFlux); + linkProcessor = linkFlux.subscribeWith(new ServiceBusReceiveLinkProcessor(10, retryPolicy, + ReceiveMode.RECEIVE_AND_DELETE)); when(connection.getEndpointStates()).thenReturn(Flux.create(sink -> sink.next(AmqpEndpointState.ACTIVE))); when(link.updateDisposition(anyString(), any(DeliveryState.class))).thenReturn(Mono.empty()); @@ -105,43 +92,11 @@ void teardown(TestInfo testInfo) { logger.info("[{}]: Tearing down.", testInfo.getDisplayName()); Mockito.framework().clearInlineMocks(); - } - - /** - * Verifies that we can receive messages from the processor and auto complete them. - */ - @Test - void receiveAutoComplete() { - // Arrange - final boolean isAutoComplete = true; - final ServiceBusAsyncConsumer consumer = new ServiceBusAsyncConsumer(LINK_NAME, linkProcessor, - serializer, isAutoComplete, false, renewDuration, retryOptions, renewMessageLock); - - when(link.getCredits()).thenReturn(1); - - final Message message1 = mock(Message.class); - final Message message2 = mock(Message.class); - final ServiceBusReceivedMessage receivedMessage1 = mock(ServiceBusReceivedMessage.class); - final String lockToken1 = UUID.randomUUID().toString(); - final ServiceBusReceivedMessage receivedMessage2 = mock(ServiceBusReceivedMessage.class); - final String lockToken2 = UUID.randomUUID().toString(); - when(receivedMessage1.getLockToken()).thenReturn(lockToken1); - when(receivedMessage2.getLockToken()).thenReturn(lockToken2); - - when(serializer.deserialize(message1, ServiceBusReceivedMessage.class)).thenReturn(receivedMessage1); - when(serializer.deserialize(message2, ServiceBusReceivedMessage.class)).thenReturn(receivedMessage2); - - // Act and Assert - StepVerifier.create(consumer.receive().take(2)) - .then(() -> { - messageProcessorSink.next(message1); - messageProcessorSink.next(message2); - }) - .expectNext(receivedMessage1, receivedMessage2) - .verifyComplete(); - - verify(link).updateDisposition(eq(lockToken1), eq(Accepted.getInstance())); + linkProcessor.dispose(); + linkPublisher.complete(); + endpointPublisher.complete(); + messagePublisher.complete(); } /** @@ -150,9 +105,9 @@ void receiveAutoComplete() { @Test void receiveNoAutoComplete() { // Arrange - final boolean isAutoComplete = false; + final int prefetch = 10; final ServiceBusAsyncConsumer consumer = new ServiceBusAsyncConsumer(LINK_NAME, linkProcessor, serializer, - isAutoComplete, false, renewDuration, retryOptions, renewMessageLock); + prefetch); final Message message1 = mock(Message.class); final Message message2 = mock(Message.class); @@ -169,9 +124,13 @@ void receiveNoAutoComplete() { // Act and Assert StepVerifier.create(consumer.receive()) - .then(() -> messageProcessorSink.next(message1)) + .then(() -> { + linkPublisher.next(link); + endpointPublisher.next(AmqpEndpointState.ACTIVE); + messagePublisher.next(message1); + }) .expectNext(receivedMessage1) - .then(() -> messageProcessorSink.next(message2)) + .then(() -> messagePublisher.next(message2)) .expectNext(receivedMessage2) .thenCancel() .verify(); @@ -185,13 +144,10 @@ void receiveNoAutoComplete() { @Test void canDispose() { // Arrange - final boolean isAutoComplete = false; + final int prefetch = 10; final String lockToken = UUID.randomUUID().toString(); - when(linkProcessor.updateDisposition(lockToken, Accepted.getInstance())) - .thenReturn(Mono.error(new IllegalArgumentException("Should not have called complete."))); - - final ServiceBusAsyncConsumer consumer = new ServiceBusAsyncConsumer(LINK_NAME, linkProcessor, - serializer, isAutoComplete, false, renewDuration, retryOptions, renewMessageLock); + final ServiceBusAsyncConsumer consumer = new ServiceBusAsyncConsumer(LINK_NAME, linkProcessor, serializer, + prefetch); final Message message1 = mock(Message.class); final ServiceBusReceivedMessage receivedMessage1 = mock(ServiceBusReceivedMessage.class); @@ -202,11 +158,15 @@ void canDispose() { // Act and Assert StepVerifier.create(consumer.receive()) .then(() -> { - endpointProcessorSink.next(AmqpEndpointState.ACTIVE); - messageProcessorSink.next(message1); + linkPublisher.next(link); + endpointPublisher.next(AmqpEndpointState.ACTIVE); + messagePublisher.next(message1); }) .expectNext(receivedMessage1) - .then(() -> consumer.close()) + .then(() -> { + linkPublisher.complete(); + endpointPublisher.complete(); + }) .verifyComplete(); verify(link, never()).updateDisposition(anyString(), any(DeliveryState.class)); diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusManagementAsyncClientIntegrationTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusManagementAsyncClientIntegrationTest.java index db02d20dac63..69dd1facf15a 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusManagementAsyncClientIntegrationTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusManagementAsyncClientIntegrationTest.java @@ -11,6 +11,7 @@ import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.test.TestBase; +import com.azure.messaging.servicebus.models.NamespaceType; import com.azure.messaging.servicebus.models.QueueDescription; import com.azure.messaging.servicebus.models.QueueRuntimeInfo; import com.azure.messaging.servicebus.models.SubscriptionDescription; @@ -19,6 +20,7 @@ import com.azure.messaging.servicebus.models.TopicRuntimeInfo; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; @@ -29,6 +31,9 @@ import java.time.OffsetDateTime; import java.util.stream.Stream; +import static com.azure.messaging.servicebus.TestUtils.getEntityName; +import static com.azure.messaging.servicebus.TestUtils.getSessionSubscriptionBaseName; +import static com.azure.messaging.servicebus.TestUtils.getTopicBaseName; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -37,6 +42,7 @@ /** * Tests {@link ServiceBusManagementAsyncClient}. */ +@Tag("integration") class ServiceBusManagementAsyncClientIntegrationTest extends TestBase { private static final Duration TIMEOUT = Duration.ofSeconds(20); @@ -60,7 +66,6 @@ void createQueue(HttpClient httpClient) { // Arrange final ServiceBusManagementAsyncClient client = createClient(httpClient); final String queueName = testResourceNamer.randomName("test", 10); - final OffsetDateTime nowUtc = OffsetDateTime.now(Clock.systemUTC()); final QueueDescription expected = new QueueDescription(queueName) .setMaxSizeInMegabytes(500) .setMaxDeliveryCount(7) @@ -90,7 +95,6 @@ void createQueue(HttpClient httpClient) { assertEquals(0, runtimeInfo.getMessageCount()); assertEquals(0, runtimeInfo.getSizeInBytes()); assertNotNull(runtimeInfo.getCreatedAt()); - assertTrue(nowUtc.isAfter(runtimeInfo.getCreatedAt())); }) .verifyComplete(); } @@ -101,7 +105,7 @@ void createQueueExistingName(HttpClient httpClient) { // Arrange final String queueName = interceptorManager.isPlaybackMode() ? "queue-5" - : TestUtils.getEntityName(TestUtils.getQueueBaseName(), 5); + : getEntityName(TestUtils.getQueueBaseName(), 5); final QueueDescription queueDescription = new QueueDescription(queueName); final ServiceBusManagementAsyncClient client = createClient(httpClient); @@ -117,8 +121,8 @@ void createSubscription(HttpClient httpClient) { // Arrange final ServiceBusManagementAsyncClient client = createClient(httpClient); final String topicName = interceptorManager.isPlaybackMode() - ? "topic" - : TestUtils.getTopicName(); + ? "topic-0" + : getEntityName(getTopicBaseName(), 0); final String subscriptionName = testResourceNamer.randomName("sub", 10); final SubscriptionDescription expected = new SubscriptionDescription(topicName, subscriptionName) .setMaxDeliveryCount(7) @@ -146,11 +150,11 @@ void createSubscription(HttpClient httpClient) { void createSubscriptionExistingName(HttpClient httpClient) { // Arrange final String topicName = interceptorManager.isPlaybackMode() - ? "topic" - : TestUtils.getTopicName(); + ? "topic-1" + : getEntityName(getTopicBaseName(), 1); final String subscriptionName = interceptorManager.isPlaybackMode() - ? "subscription-session-1" - : TestUtils.getEntityName(TestUtils.getSessionSubscriptionBaseName(), 1); + ? "subscription-session" + : getSessionSubscriptionBaseName(); final ServiceBusManagementAsyncClient client = createClient(httpClient); // Act & Assert @@ -165,7 +169,6 @@ void createTopicWithResponse(HttpClient httpClient) { // Arrange final ServiceBusManagementAsyncClient client = createClient(httpClient); final String topicName = testResourceNamer.randomName("test", 10); - final OffsetDateTime nowUtc = OffsetDateTime.now(Clock.systemUTC()); final TopicDescription expected = new TopicDescription(topicName) .setMaxSizeInMegabytes(2048L) .setRequiresDuplicateDetection(true) @@ -193,7 +196,6 @@ void createTopicWithResponse(HttpClient httpClient) { assertEquals(0, runtimeInfo.getSubscriptionCount()); assertEquals(0, runtimeInfo.getSizeInBytes()); assertNotNull(runtimeInfo.getCreatedAt()); - assertTrue(nowUtc.isAfter(runtimeInfo.getCreatedAt())); }) .verifyComplete(); } @@ -249,7 +251,7 @@ void getQueue(HttpClient httpClient) { final ServiceBusManagementAsyncClient client = createClient(httpClient); final String queueName = interceptorManager.isPlaybackMode() ? "queue-5" - : TestUtils.getEntityName(TestUtils.getQueueBaseName(), 5); + : getEntityName(TestUtils.getQueueBaseName(), 5); final OffsetDateTime nowUtc = OffsetDateTime.now(Clock.systemUTC()); // Act & Assert @@ -269,6 +271,28 @@ void getQueue(HttpClient httpClient) { .verifyComplete(); } + @ParameterizedTest + @MethodSource("createHttpClients") + void getNamespace(HttpClient httpClient) { + // Arrange + final ServiceBusManagementAsyncClient client = createClient(httpClient); + final String expectedName; + if (interceptorManager.isPlaybackMode()) { + expectedName = "ShivangiServiceBus"; + } else { + final String[] split = TestUtils.getFullyQualifiedDomainName().split("\\.", 2); + expectedName = split[0]; + } + + // Act & Assert + StepVerifier.create(client.getNamespaceProperties()) + .assertNext(properties -> { + assertEquals(NamespaceType.MESSAGING, properties.getNamespaceType()); + assertEquals(expectedName, properties.getName()); + }) + .verifyComplete(); + } + @ParameterizedTest @MethodSource("createHttpClients") void getQueueDoesNotExist(HttpClient httpClient) { @@ -282,6 +306,34 @@ void getQueueDoesNotExist(HttpClient httpClient) { .verify(); } + @ParameterizedTest + @MethodSource("createHttpClients") + void getQueueExists(HttpClient httpClient) { + // Arrange + final ServiceBusManagementAsyncClient client = createClient(httpClient); + final String queueName = interceptorManager.isPlaybackMode() + ? "queue-2" + : getEntityName(TestUtils.getQueueBaseName(), 2); + + // Act & Assert + StepVerifier.create(client.getQueueExists(queueName)) + .expectNext(true) + .verifyComplete(); + } + + @ParameterizedTest + @MethodSource("createHttpClients") + void getQueueExistsFalse(HttpClient httpClient) { + // Arrange + final ServiceBusManagementAsyncClient client = createClient(httpClient); + final String queueName = testResourceNamer.randomName("exist", 10); + + // Act & Assert + StepVerifier.create(client.getQueueExists(queueName)) + .expectNext(false) + .verifyComplete(); + } + @ParameterizedTest @MethodSource("createHttpClients") void getQueueRuntimeInfo(HttpClient httpClient) { @@ -289,7 +341,7 @@ void getQueueRuntimeInfo(HttpClient httpClient) { final ServiceBusManagementAsyncClient client = createClient(httpClient); final String queueName = interceptorManager.isPlaybackMode() ? "queue-2" - : TestUtils.getEntityName(TestUtils.getQueueBaseName(), 2); + : getEntityName(TestUtils.getQueueBaseName(), 2); final OffsetDateTime nowUtc = OffsetDateTime.now(Clock.systemUTC()); // Act & Assert @@ -309,10 +361,10 @@ void getQueueRuntimeInfo(HttpClient httpClient) { void getSubscription(HttpClient httpClient) { // Arrange final ServiceBusManagementAsyncClient client = createClient(httpClient); - final String topicName = interceptorManager.isPlaybackMode() ? "topic" : TestUtils.getTopicName(); + final String topicName = interceptorManager.isPlaybackMode() ? "topic-1" : getEntityName(getTopicBaseName(), 1); final String subscriptionName = interceptorManager.isPlaybackMode() - ? "subscription-session-1" - : TestUtils.getEntityName(TestUtils.getSessionSubscriptionBaseName(), 1); + ? "subscription-session" + : getSessionSubscriptionBaseName(); final OffsetDateTime nowUtc = OffsetDateTime.now(Clock.systemUTC()); // Act & Assert @@ -337,7 +389,7 @@ void getSubscription(HttpClient httpClient) { void getSubscriptionDoesNotExist(HttpClient httpClient) { // Arrange final ServiceBusManagementAsyncClient client = createClient(httpClient); - final String topicName = interceptorManager.isPlaybackMode() ? "topic" : TestUtils.getTopicName(); + final String topicName = interceptorManager.isPlaybackMode() ? "topic-1" : getEntityName(getTopicBaseName(), 1); final String subscriptionName = "subscription-session-not-exist"; // Act & Assert @@ -346,15 +398,47 @@ void getSubscriptionDoesNotExist(HttpClient httpClient) { .verify(); } + @ParameterizedTest + @MethodSource("createHttpClients") + void getSubscriptionExists(HttpClient httpClient) { + // Arrange + final ServiceBusManagementAsyncClient client = createClient(httpClient); + final String topicName = interceptorManager.isPlaybackMode() + ? "topic-1" + : getEntityName(getTopicBaseName(), 1); + final String subscriptionName = interceptorManager.isPlaybackMode() + ? "subscription-session" + : getSessionSubscriptionBaseName(); + + // Act & Assert + StepVerifier.create(client.getSubscriptionExists(topicName, subscriptionName)) + .expectNext(true) + .verifyComplete(); + } + + @ParameterizedTest + @MethodSource("createHttpClients") + void getSubscriptionExistsFalse(HttpClient httpClient) { + // Arrange + final ServiceBusManagementAsyncClient client = createClient(httpClient); + final String topicName = interceptorManager.isPlaybackMode() ? "topic-1" : getEntityName(getTopicBaseName(), 1); + final String subscriptionName = "subscription-session-not-exist"; + + // Act & Assert + StepVerifier.create(client.getSubscriptionExists(topicName, subscriptionName)) + .expectNext(false) + .verifyComplete(); + } + @ParameterizedTest @MethodSource("createHttpClients") void getSubscriptionRuntimeInfo(HttpClient httpClient) { // Arrange final ServiceBusManagementAsyncClient client = createClient(httpClient); - final String topicName = interceptorManager.isPlaybackMode() ? "topic" : TestUtils.getTopicName(); + final String topicName = interceptorManager.isPlaybackMode() ? "topic-1" : getEntityName(getTopicBaseName(), 1); final String subscriptionName = interceptorManager.isPlaybackMode() - ? "subscription-1" - : TestUtils.getEntityName(TestUtils.getSubscriptionBaseName(), 1); + ? "subscription-session" + : getSessionSubscriptionBaseName(); final OffsetDateTime nowUtc = OffsetDateTime.now(Clock.systemUTC()); // Act & Assert @@ -384,8 +468,8 @@ void getTopic(HttpClient httpClient) { // Arrange final ServiceBusManagementAsyncClient client = createClient(httpClient); final String topicName = interceptorManager.isPlaybackMode() - ? "topic" - : TestUtils.getTopicName(); + ? "topic-1" + : getEntityName(getTopicBaseName(), 1); final OffsetDateTime nowUtc = OffsetDateTime.now(Clock.systemUTC()); // Act & Assert @@ -430,14 +514,42 @@ void getTopicDoesNotExist(HttpClient httpClient) { .verify(); } + @ParameterizedTest + @MethodSource("createHttpClients") + void getTopicExists(HttpClient httpClient) { + // Arrange + final ServiceBusManagementAsyncClient client = createClient(httpClient); + final String topicName = interceptorManager.isPlaybackMode() + ? "topic-1" + : getEntityName(getTopicBaseName(), 1); + + // Act & Assert + StepVerifier.create(client.getTopicExists(topicName)) + .expectNext(true) + .verifyComplete(); + } + + @ParameterizedTest + @MethodSource("createHttpClients") + void getTopicExistsFalse(HttpClient httpClient) { + // Arrange + final ServiceBusManagementAsyncClient client = createClient(httpClient); + final String topicName = testResourceNamer.randomName("exists", 10); + + // Act & Assert + StepVerifier.create(client.getTopicExists(topicName)) + .expectNext(false) + .verifyComplete(); + } + @ParameterizedTest @MethodSource("createHttpClients") void getTopicRuntimeInfo(HttpClient httpClient) { // Arrange final ServiceBusManagementAsyncClient client = createClient(httpClient); final String topicName = interceptorManager.isPlaybackMode() - ? "topic" - : TestUtils.getTopicName(); + ? "topic-1" + : getEntityName(getTopicBaseName(), 1); final OffsetDateTime nowUtc = OffsetDateTime.now(Clock.systemUTC()); // Act & Assert @@ -446,7 +558,7 @@ void getTopicRuntimeInfo(HttpClient httpClient) { assertEquals(topicName, runtimeInfo.getName()); if (interceptorManager.isPlaybackMode()) { - assertEquals(22, runtimeInfo.getSubscriptionCount()); + assertEquals(3, runtimeInfo.getSubscriptionCount()); } else { assertTrue(runtimeInfo.getSubscriptionCount() > 1); } @@ -484,8 +596,8 @@ void listSubscriptions(HttpClient httpClient) { // Arrange final ServiceBusManagementAsyncClient client = createClient(httpClient); final String topicName = interceptorManager.isPlaybackMode() - ? "topic" - : TestUtils.getTopicName(); + ? "topic-1" + : getEntityName(getTopicBaseName(), 1); // Act & Assert StepVerifier.create(client.listSubscriptions(topicName)) @@ -526,6 +638,9 @@ private ServiceBusManagementAsyncClient createClient(HttpClient httpClient) { if (interceptorManager.isPlaybackMode()) { builder.httpClient(interceptorManager.getPlaybackClient()); + } else if (interceptorManager.isLiveMode()) { + builder.httpClient(httpClient) + .addPolicy(new RetryPolicy()); } else { builder.httpClient(httpClient) .addPolicy(interceptorManager.getRecordPolicy()) 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 782cf00930ea..823605ce3297 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 @@ -668,7 +668,6 @@ void receiveAndRenewLock(MessagingEntityType entityType) { String.format("Updated lock is not after the initial Lock. updated: [%s]. initial:[%s]", lockedUntil, initialLock)); - assertEquals(receivedMessage.getLockedUntil(), lockedUntil); }) .verifyComplete(); } finally { @@ -934,44 +933,6 @@ void setAndGetSessionState(MessagingEntityType entityType) { messagesPending.decrementAndGet(); } - @MethodSource("com.azure.messaging.servicebus.IntegrationTestBase#messagingEntityProvider") - @ParameterizedTest - void receivesByNumber(MessagingEntityType entityType) { - // Arrange - setSenderAndReceiver(entityType, TestUtils.USE_CASE_RECEIVE_BY_NUMBER, false); - - final String messageId = UUID.randomUUID().toString(); - final int number = 10; - final List messages = TestUtils.getServiceBusMessages(number, messageId, CONTENTS_BYTES); - - sendMessage(messages).block(Duration.ofSeconds(10)); - - // Act & Assert - StepVerifier.create(receiveAndDeleteReceiver.receiveMessages(messages.size(), Duration.ofSeconds(15)) - .doOnNext(next -> messagesPending.decrementAndGet())) - .expectNextCount(number) - .verifyComplete(); - } - - @MethodSource("com.azure.messaging.servicebus.IntegrationTestBase#messagingEntityProvider") - @ParameterizedTest - void receivesByTime(MessagingEntityType entityType) { - // Arrange - - setSenderAndReceiver(entityType, TestUtils.USE_CASE_RECEIVE_BY_TIME, false); - final String messageId = UUID.randomUUID().toString(); - final int number = 10; - final List messages = TestUtils.getServiceBusMessages(number, messageId, CONTENTS_BYTES); - - sendMessage(messages).block(Duration.ofSeconds(15)); - - // Act & Assert - StepVerifier.create(receiveAndDeleteReceiver.receiveMessages(number + 10, Duration.ofSeconds(15)) - .doOnNext(next -> messagesPending.decrementAndGet())) - .expectNextCount(number) - .verifyComplete(); - } - /** * Verifies that we can receive a message from dead letter queue. */ diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceiverClientIntegrationTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceiverClientIntegrationTest.java index 99368894f49c..25e7bafbbd9d 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceiverClientIntegrationTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceiverClientIntegrationTest.java @@ -15,7 +15,6 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.EnumSource; import org.junit.jupiter.params.provider.MethodSource; -import reactor.core.publisher.Mono; import java.time.Duration; import java.time.Instant; @@ -114,7 +113,6 @@ void multipleReceiveByOneSubscriberMessageTimeout(MessagingEntityType entityType final int maxMessages = 2; final int totalReceive = 2; final Duration shortTimeOut = Duration.ofSeconds(7); - final Duration longTimeOut = Duration.ofSeconds(10); final String messageId = UUID.randomUUID().toString(); List messageList = new ArrayList<>(); @@ -122,18 +120,13 @@ void multipleReceiveByOneSubscriberMessageTimeout(MessagingEntityType entityType messageList.add(getMessage(messageId, isSessionEnabled)); } - Mono.just(true) - .delayElement(longTimeOut) - .map(aBoolean -> { - sendMessages(messageList); - return aBoolean; - }) - .subscribe(); // Act & Assert IterableStream messages = receiver.receiveMessages(maxMessages, shortTimeOut); long received = messages.stream().count(); assertEquals(0, received); + sendMessages(messageList); + int receivedMessageCount; int totalReceivedCount = 0; for (int i = 0; i < totalReceive; ++i) { 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 a602c75f8582..34d81c258099 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 @@ -247,20 +247,24 @@ void transactionMessageSendAndCompleteTransaction(MessagingEntityType entityType if (isCommit) { StepVerifier.create(sender.commitTransaction(transaction.get()).delaySubscription(Duration.ofSeconds(1))) .verifyComplete(); - StepVerifier.create(receiver.receiveMessages().take(total).timeout(shortTimeout)) + StepVerifier.create(receiver.receiveMessages().take(total)) .assertNext(receivedMessage -> { + System.out.println("1"); assertMessageEquals(receivedMessage, messageId, isSessionEnabled); messagesPending.decrementAndGet(); }) .assertNext(receivedMessage -> { + System.out.println("2"); assertMessageEquals(receivedMessage, messageId, isSessionEnabled); messagesPending.decrementAndGet(); }) .assertNext(receivedMessage -> { + System.out.println("3"); assertMessageEquals(receivedMessage, messageId, isSessionEnabled); messagesPending.decrementAndGet(); }) - .verifyComplete(); + .expectComplete() + .verify(shortTimeout); } else { StepVerifier.create(sender.rollbackTransaction(transaction.get()).delaySubscription(Duration.ofSeconds(1))) .verifyComplete(); diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/TestUtils.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/TestUtils.java index 9e945b49236c..3ceae34a1064 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/TestUtils.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/TestUtils.java @@ -99,15 +99,6 @@ public static String getSessionQueueBaseName() { return System.getenv("AZURE_SERVICEBUS_SESSION_QUEUE_NAME"); } - /** - * The Service Bus topic name. - * - * @return The Service bus topic name. - */ - public static String getTopicName() { - return System.getenv("AZURE_SERVICEBUS_TOPIC_NAME"); - } - /** * Gets the Service Bus subscription name (NOT session enabled) * diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/UnnamedSessionManagerTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/UnnamedSessionManagerTest.java index fd206b444401..9dacc8031c5f 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/UnnamedSessionManagerTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/UnnamedSessionManagerTest.java @@ -37,10 +37,13 @@ import reactor.core.publisher.ReplayProcessor; import reactor.core.scheduler.Schedulers; import reactor.test.StepVerifier; +import reactor.test.publisher.TestPublisher; import java.time.Duration; import java.time.Instant; import java.util.Collections; +import java.util.concurrent.Callable; +import java.util.concurrent.atomic.AtomicInteger; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; @@ -122,11 +125,16 @@ void beforeEach(TestInfo testInfo) { @AfterEach void afterEach(TestInfo testInfo) { logger.info("===== [{}] Tearing down. =====", testInfo.getDisplayName()); - Mockito.framework().clearInlineMocks(); if (sessionManager != null) { sessionManager.close(); } + + if (connectionProcessor != null) { + connectionProcessor.dispose(); + } + + Mockito.framework().clearInlineMocks(); } @Test @@ -148,8 +156,8 @@ void receiveNull() { @Test void singleUnnamedSession() { // Arrange - ReceiverOptions receiverOptions = new ReceiverOptions(ReceiveMode.PEEK_LOCK, 1, Duration.ofSeconds(20), - null, false, null); + ReceiverOptions receiverOptions = new ReceiverOptions(ReceiveMode.PEEK_LOCK, 1, + Duration.ofSeconds(20), null, false, null); sessionManager = new UnnamedSessionManager(ENTITY_PATH, ENTITY_TYPE, connectionProcessor, TIMEOUT, tracerProvider, messageSerializer, receiverOptions); @@ -176,7 +184,8 @@ void singleUnnamedSession() { when(connection.createReceiveLink(anyString(), eq(ENTITY_PATH), any(ReceiveMode.class), isNull(), any(MessagingEntityType.class), isNull())).thenReturn(Mono.just(amqpReceiveLink)); - when(managementNode.renewSessionLock(sessionId, linkName)).thenReturn(Mono.empty()); + when(managementNode.renewSessionLock(sessionId, linkName)).thenReturn( + Mono.fromCallable(() -> Instant.now().plus(Duration.ofSeconds(5)))); // Act & Assert StepVerifier.create(sessionManager.receive()) @@ -185,11 +194,11 @@ void singleUnnamedSession() { messageSink.next(message); } }) - .assertNext(context -> assertMessageEquals(receivedMessage, context)) - .assertNext(context -> assertMessageEquals(receivedMessage, context)) - .assertNext(context -> assertMessageEquals(receivedMessage, context)) - .assertNext(context -> assertMessageEquals(receivedMessage, context)) - .assertNext(context -> assertMessageEquals(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)) + .assertNext(context -> assertMessageEquals(sessionId, receivedMessage, context)) .expectComplete() .verify(); } @@ -200,35 +209,70 @@ void singleUnnamedSession() { @Test void multipleSessions() { // Arrange - ReceiverOptions receiverOptions = new ReceiverOptions(ReceiveMode.PEEK_LOCK, 1, Duration.ofSeconds(20), - null, false, null); + final ReceiverOptions receiverOptions = new ReceiverOptions(ReceiveMode.PEEK_LOCK, 1, + Duration.ofSeconds(8), null, true, 1); sessionManager = new UnnamedSessionManager(ENTITY_PATH, ENTITY_TYPE, connectionProcessor, TIMEOUT, tracerProvider, messageSerializer, receiverOptions); final int numberOfMessages = 5; + final Callable onRenewal = () -> Instant.now().plus(Duration.ofSeconds(5)); + final String sessionId = "session-1"; final String lockToken = "a-lock-token"; final String linkName = "my-link-name"; - final Instant sessionLockedUntil = Instant.now().plus(Duration.ofSeconds(5)); final Message message = mock(Message.class); final ServiceBusReceivedMessage receivedMessage = mock(ServiceBusReceivedMessage.class); - when(messageSerializer.deserialize(message, ServiceBusReceivedMessage.class)).thenReturn(receivedMessage); when(receivedMessage.getSessionId()).thenReturn(sessionId); when(receivedMessage.getLockToken()).thenReturn(lockToken); - when(amqpReceiveLink.getLinkName()).thenReturn(linkName); when(amqpReceiveLink.getSessionId()).thenReturn(Mono.just(sessionId)); - when(amqpReceiveLink.getSessionLockedUntil()) - .thenAnswer(invocation -> Mono.just(sessionLockedUntil)); + when(amqpReceiveLink.getSessionLockedUntil()).thenReturn(Mono.fromCallable(onRenewal)); when(amqpReceiveLink.updateDisposition(lockToken, Accepted.getInstance())).thenReturn(Mono.empty()); + // Session 2's messages + final ServiceBusReceiveLink amqpReceiveLink2 = mock(ServiceBusReceiveLink.class); + final Message message2 = mock(Message.class); + final ServiceBusReceivedMessage receivedMessage2 = mock(ServiceBusReceivedMessage.class); + final String sessionId2 = "session-2"; + final String lockToken2 = "a-lock-token-2"; + final String linkName2 = "my-link-name-2"; + final TestPublisher messagePublisher2 = TestPublisher.create(); + final Flux messageFlux2 = messagePublisher2.flux(); + + when(receivedMessage2.getSessionId()).thenReturn(sessionId2); + when(receivedMessage2.getLockToken()).thenReturn(lockToken2); + + when(amqpReceiveLink2.receive()).thenReturn(messageFlux2); + when(amqpReceiveLink2.getHostname()).thenReturn(NAMESPACE); + when(amqpReceiveLink2.getEntityPath()).thenReturn(ENTITY_PATH); + when(amqpReceiveLink2.getEndpointStates()).thenReturn(endpointProcessor); + when(amqpReceiveLink2.getLinkName()).thenReturn(linkName2); + when(amqpReceiveLink2.getSessionId()).thenReturn(Mono.just(sessionId2)); + when(amqpReceiveLink2.getSessionLockedUntil()).thenReturn(Mono.fromCallable(onRenewal)); + when(amqpReceiveLink2.updateDisposition(lockToken2, Accepted.getInstance())).thenReturn(Mono.empty()); + + final AtomicInteger count = new AtomicInteger(); when(connection.createReceiveLink(anyString(), eq(ENTITY_PATH), any(ReceiveMode.class), isNull(), - any(MessagingEntityType.class), isNull())).thenReturn(Mono.just(amqpReceiveLink)); + any(MessagingEntityType.class), isNull())).thenAnswer(invocation -> { + final int number = count.getAndIncrement(); + switch (number) { + case 0: + return Mono.just(amqpReceiveLink); + case 1: + return Mono.just(amqpReceiveLink2); + default: + return Mono.empty(); + } + }); - when(managementNode.renewSessionLock(sessionId, linkName)).thenReturn(Mono.empty()); + when(messageSerializer.deserialize(message, ServiceBusReceivedMessage.class)).thenReturn(receivedMessage); + when(messageSerializer.deserialize(message2, ServiceBusReceivedMessage.class)).thenReturn(receivedMessage2); + + when(managementNode.renewSessionLock(sessionId, linkName)).thenReturn(Mono.fromCallable(onRenewal)); + when(managementNode.renewSessionLock(sessionId2, linkName2)).thenReturn(Mono.fromCallable(onRenewal)); // Act & Assert StepVerifier.create(sessionManager.receive()) @@ -237,19 +281,54 @@ void multipleSessions() { messageSink.next(message); } }) - .assertNext(context -> assertMessageEquals(receivedMessage, context)) - .assertNext(context -> assertMessageEquals(receivedMessage, context)) - .assertNext(context -> assertMessageEquals(receivedMessage, context)) - .assertNext(context -> assertMessageEquals(receivedMessage, context)) - .assertNext(context -> assertMessageEquals(receivedMessage, context)) - .expectComplete() + .assertNext(context -> { + System.out.println("1"); + assertMessageEquals(sessionId, receivedMessage, context); + }) + .assertNext(context -> { + System.out.println("2"); + assertMessageEquals(sessionId, receivedMessage, context); + }) + .assertNext(context -> { + System.out.println("3"); + assertMessageEquals(sessionId, receivedMessage, context); + }) + .assertNext(context -> { + System.out.println("4"); + assertMessageEquals(sessionId, receivedMessage, context); + }) + .assertNext(context -> { + System.out.println("5"); + assertMessageEquals(sessionId, receivedMessage, context); + }) + .thenAwait(Duration.ofSeconds(13)) + .then(() -> { + for (int i = 0; i < 3; i++) { + messagePublisher2.next(message2); + } + }) + .assertNext(context -> { + System.out.println("6"); + assertMessageEquals(sessionId2, receivedMessage2, context); + }) + .assertNext(context -> { + System.out.println("7"); + assertMessageEquals(sessionId2, receivedMessage2, context); + }) + .assertNext(context -> { + System.out.println("8"); + assertMessageEquals(sessionId2, receivedMessage2, context); + }) + .thenAwait(Duration.ofSeconds(15)) + .thenCancel() .verify(); } - private static void assertMessageEquals(ServiceBusReceivedMessage expected, + private static void assertMessageEquals(String sessionId, ServiceBusReceivedMessage expected, ServiceBusReceivedMessageContext actual) { - assertEquals(expected, actual.getMessage()); + assertEquals(sessionId, actual.getSessionId()); assertNull(actual.getThrowable()); - assertEquals(expected.getSessionId(), actual.getSessionId()); + + assertEquals(expected, actual.getMessage()); } } diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusManagementSerializerTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusManagementSerializerTest.java index b0b193eb250f..43180bf17d11 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusManagementSerializerTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusManagementSerializerTest.java @@ -3,6 +3,7 @@ package com.azure.messaging.servicebus.implementation; +import com.azure.messaging.servicebus.implementation.models.NamespacePropertiesEntry; import com.azure.messaging.servicebus.implementation.models.QueueDescriptionEntry; import com.azure.messaging.servicebus.implementation.models.QueueDescriptionEntryContent; import com.azure.messaging.servicebus.implementation.models.QueueDescriptionFeed; @@ -13,6 +14,9 @@ import com.azure.messaging.servicebus.implementation.models.SubscriptionDescriptionFeed; import com.azure.messaging.servicebus.models.EntityStatus; import com.azure.messaging.servicebus.models.MessageCountDetails; +import com.azure.messaging.servicebus.models.MessagingSku; +import com.azure.messaging.servicebus.models.NamespaceProperties; +import com.azure.messaging.servicebus.models.NamespaceType; import com.azure.messaging.servicebus.models.QueueDescription; import com.azure.messaging.servicebus.models.QueueRuntimeInfo; import com.azure.messaging.servicebus.models.SubscriptionDescription; @@ -225,6 +229,39 @@ void deserializeQueueDescriptionFeedPaged() throws IOException { } } + /** + * Verify we can deserialize XML from a GET namespace request. + */ + @Test + void deserializeNamespace() throws IOException { + // Arrange + final String contents = getContents("NamespaceEntry.xml"); + final String name = "ShivangiServiceBus"; + final String alias = "MyServiceBusFallback"; + final OffsetDateTime createdTime = OffsetDateTime.parse("2020-04-09T08:38:55.807Z"); + final OffsetDateTime modifiedTime = OffsetDateTime.parse("2020-06-12T06:34:38.383Z"); + final MessagingSku sku = MessagingSku.PREMIUM; + final NamespaceType namespaceType = NamespaceType.MESSAGING; + + // Act + final NamespacePropertiesEntry entry = serializer.deserialize(contents, NamespacePropertiesEntry.class); + + // Assert + assertNotNull(entry); + assertNotNull(entry.getContent()); + + // The entry title is the name of the queue. + assertTitle(name, entry.getTitle()); + + final NamespaceProperties actual = entry.getContent().getNamespaceProperties(); + assertEquals(name, actual.getName()); + assertEquals(alias, actual.getAlias()); + assertEquals(createdTime, actual.getCreatedTime()); + assertEquals(modifiedTime, actual.getModifiedTime()); + assertEquals(sku, actual.getMessagingSku()); + assertEquals(namespaceType, actual.getNamespaceType()); + } + /** * Verify we can deserialize XML from a GET subscription request. */ diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusMessageProcessorTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusMessageProcessorTest.java deleted file mode 100644 index e458b17cc77a..000000000000 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusMessageProcessorTest.java +++ /dev/null @@ -1,284 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.messaging.servicebus.implementation; - -import com.azure.core.amqp.AmqpRetryOptions; -import com.azure.core.amqp.exception.AmqpErrorCondition; -import com.azure.core.amqp.exception.AmqpErrorContext; -import com.azure.core.amqp.exception.AmqpException; -import com.azure.core.amqp.exception.LinkErrorContext; -import com.azure.core.util.logging.ClientLogger; -import com.azure.messaging.servicebus.ServiceBusReceivedMessage; -import org.apache.qpid.proton.amqp.messaging.Accepted; -import org.apache.qpid.proton.amqp.transport.DeliveryState; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; -import reactor.core.publisher.Mono; -import reactor.test.StepVerifier; - -import java.time.Duration; -import java.time.Instant; -import java.util.UUID; -import java.util.concurrent.TimeUnit; - -import static com.azure.messaging.servicebus.TestUtils.createMessageSink; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; - -class ServiceBusMessageProcessorTest { - private static final String LINK_NAME = "some-link"; - @Mock - private ServiceBusReceivedMessage message1; - @Mock - private ServiceBusReceivedMessage message2; - @Mock - private ServiceBusReceivedMessage message3; - @Mock - private ServiceBusReceivedMessage message4; - - @Mock - private MessageManagementOperations messageManagementOperations; - - private final AmqpErrorContext errorContext = new LinkErrorContext("foo", "bar", "link-name", 10); - private final ClientLogger logger = new ClientLogger(ServiceBusMessageProcessorTest.class); - private final AmqpRetryOptions retryOptions = new AmqpRetryOptions(); - - @BeforeEach - void setup() { - MockitoAnnotations.initMocks(this); - when(messageManagementOperations.updateDisposition(anyString(), any(DeliveryState.class))) - .thenReturn(Mono.empty()); - } - - @AfterEach - void teardown() { - Mockito.framework().clearInlineMocks(); - } - - /** - * Verifies that all messages are emitted downstream. - */ - @Test - void autoCompletesNoAutoRenew() { - // Arrange - final String lock1 = UUID.randomUUID().toString(); - final String lock2 = UUID.randomUUID().toString(); - final String lock3 = UUID.randomUUID().toString(); - final String lock4 = UUID.randomUUID().toString(); - - when(message1.getLockToken()).thenReturn(lock1); - when(message2.getLockToken()).thenReturn(lock2); - when(message3.getLockToken()).thenReturn(lock3); - when(message4.getLockToken()).thenReturn(lock4); - - final ServiceBusMessageProcessor processor = createMessageSink(message1, message2, message3, message4) - .subscribeWith(new ServiceBusMessageProcessor(LINK_NAME, true, false, Duration.ZERO, - retryOptions, errorContext, messageManagementOperations)); - - // Act & Assert - StepVerifier.create(processor) - .expectNext(message1, message2, message3, message4) - .verifyComplete(); - - verify(messageManagementOperations).updateDisposition(lock1, Accepted.getInstance()); - verify(messageManagementOperations).updateDisposition(lock2, Accepted.getInstance()); - verify(messageManagementOperations).updateDisposition(lock3, Accepted.getInstance()); - } - - /** - * Verifies that all messages are emitted downstream. - */ - @Disabled("Fails on Ubuntu 18") - @Test - void autoCompletesAndAutoRenews() { - // Arrange - final Duration maxRenewDuration = Duration.ofSeconds(60); - - final String lock1 = UUID.randomUUID().toString(); - final String lock2 = UUID.randomUUID().toString(); - when(message1.getLockToken()).thenReturn(lock1); - when(message1.getLockedUntil()).thenAnswer(invocationOnMock -> Instant.now().plusSeconds(3)); - - when(message2.getLockToken()).thenReturn(lock2); - when(message2.getLockedUntil()).thenAnswer(invocationOnMock -> Instant.now().plusSeconds(5)); - - when(messageManagementOperations.renewMessageLock(lock1, LINK_NAME)) - .thenAnswer(invocationOnMock -> Mono.just(Instant.now().plusSeconds(3))); - - final ServiceBusMessageProcessor processor = createMessageSink(message1, message2) - .subscribeWith(new ServiceBusMessageProcessor(LINK_NAME, true, true, maxRenewDuration, - retryOptions, errorContext, messageManagementOperations)); - - // Act & Assert - StepVerifier.create(processor) - .assertNext(m -> { - Assertions.assertSame(message1, m); - - logger.info("Now: {}", Instant.now()); - try { - TimeUnit.SECONDS.sleep(15); - } catch (InterruptedException ignored) { - } - logger.info("After: {}", Instant.now()); - }) - .expectNext(message2) - .verifyComplete(); - - verify(messageManagementOperations, atLeast(3)).renewMessageLock(lock1, LINK_NAME); - verify(messageManagementOperations).updateDisposition(lock1, Accepted.getInstance()); - verify(messageManagementOperations).updateDisposition(lock2, Accepted.getInstance()); - } - - /** - * Verifies that all messages are emitted downstream and auto complete is not invoked. - */ - @Test - void emitsDoesNotAutoCompleteOrRenew() { - // Arrange - final ServiceBusMessageProcessor processor = createMessageSink(message1, message2, message3, message4) - .subscribeWith(new ServiceBusMessageProcessor(LINK_NAME, false, false, Duration.ZERO, - retryOptions, errorContext, messageManagementOperations)); - - // Act & Assert - StepVerifier.create(processor) - .expectNext(message1, message2, message3, message4) - .verifyComplete(); - - verifyZeroInteractions(messageManagementOperations); - } - - /** - * When the max auto-renewal time has elapsed, we throw an error. - */ - @Disabled("Fails on Ubuntu 18") - @Test - void autoRenewExpires() { - // Arrange - final Duration maxRenewDuration = Duration.ofSeconds(4); - final String lock1 = UUID.randomUUID().toString(); - final String lock2 = UUID.randomUUID().toString(); - when(message1.getLockToken()).thenReturn(lock1); - when(message1.getLockedUntil()).thenAnswer(invocationOnMock -> Instant.now().plusSeconds(3)); - - when(message2.getLockToken()).thenReturn(lock2); - when(message2.getLockedUntil()).thenAnswer(invocationOnMock -> Instant.now().plusSeconds(5)); - - when(messageManagementOperations.renewMessageLock(lock1, LINK_NAME)) - .thenAnswer(invocationOnMock -> Mono.just(Instant.now().plusSeconds(7))); - - final ServiceBusMessageProcessor processor = createMessageSink(message1, message2) - .subscribeWith(new ServiceBusMessageProcessor(LINK_NAME, true, true, maxRenewDuration, - retryOptions, errorContext, messageManagementOperations)); - - // Act & Assert - StepVerifier.create(processor) - .assertNext(m -> { - Assertions.assertSame(message1, m); - - logger.info("Now: {}", Instant.now()); - try { - TimeUnit.SECONDS.sleep(6); - } catch (InterruptedException ignored) { - } - logger.info("After: {}", Instant.now()); - }) - .expectErrorSatisfies(error -> { - Assertions.assertTrue(error instanceof AmqpException); - Assertions.assertEquals(AmqpErrorCondition.TIMEOUT_ERROR, ((AmqpException) error).getErrorCondition()); - }) - .verify(); - - verify(messageManagementOperations).renewMessageLock(lock1, LINK_NAME); - verifyZeroInteractions(message2); - verify(messageManagementOperations, never()).updateDisposition(anyString(), any()); - } - - /** - * When an error occurs in auto-renew lock we stop processing the next items. - */ - @Disabled("Fails on Ubuntu 18") - @Test - void autoRenewOperationErrors() { - // Arrange - final Duration maxRenewDuration = Duration.ofSeconds(20); - final String lock1 = UUID.randomUUID().toString(); - final String lock2 = UUID.randomUUID().toString(); - when(message1.getLockToken()).thenReturn(lock1); - when(message1.getLockedUntil()).thenAnswer(invocationOnMock -> Instant.now().plusSeconds(3)); - - when(message2.getLockToken()).thenReturn(lock2); - when(message2.getLockedUntil()).thenAnswer(invocationOnMock -> Instant.now().plusSeconds(5)); - - when(messageManagementOperations.renewMessageLock(anyString(), any())) - .thenAnswer(invocationOnMock -> Mono.error(new IllegalArgumentException("Test error occurred."))); - - final ServiceBusMessageProcessor processor = createMessageSink(message1, message2) - .subscribeWith(new ServiceBusMessageProcessor(LINK_NAME, true, true, maxRenewDuration, - retryOptions, errorContext, messageManagementOperations)); - - // Act & Assert - StepVerifier.create(processor) - .assertNext(m -> { - Assertions.assertSame(message1, m); - - logger.info("Now: {}", Instant.now()); - try { - TimeUnit.SECONDS.sleep(10); - } catch (InterruptedException ignored) { - } - logger.info("After: {}", Instant.now()); - }) - .expectError(IllegalArgumentException.class) - .verify(); - - verifyZeroInteractions(message2); - verify(messageManagementOperations, never()).updateDisposition(lock1, Accepted.getInstance()); - } - - /** - * When an error occurs in complete, we stop processing the next items. - */ - @Test - void completeOperationErrors() { - // Arrange - final Duration maxRenewDuration = Duration.ofSeconds(10); - final String lock1 = UUID.randomUUID().toString(); - final String lock2 = UUID.randomUUID().toString(); - when(message1.getLockToken()).thenReturn(lock1); - when(message1.getLockedUntil()).thenAnswer(invocationOnMock -> Instant.now().plusSeconds(3)); - - when(message2.getLockToken()).thenReturn(lock2); - when(message2.getLockedUntil()).thenAnswer(invocationOnMock -> Instant.now().plusSeconds(5)); - - when(messageManagementOperations.updateDisposition(lock1, Accepted.getInstance())).thenAnswer( - invocationOnMock -> Mono.error(new IllegalArgumentException("Test error occurred."))); - - when(messageManagementOperations.renewMessageLock(anyString(), anyString())).thenReturn(Mono.empty()); - - final ServiceBusMessageProcessor processor = createMessageSink(message1, message2) - .subscribeWith(new ServiceBusMessageProcessor(LINK_NAME, true, true, maxRenewDuration, - retryOptions, errorContext, messageManagementOperations)); - - // Act & Assert - StepVerifier.create(processor) - .expectNext(message1) - .expectError(IllegalArgumentException.class) - .verify(); - - verify(messageManagementOperations).updateDisposition(lock1, Accepted.getInstance()); - - verifyZeroInteractions(message2); - verify(messageManagementOperations, never()).renewMessageLock(anyString(), anyString()); - } -} 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 52aa09adf4a8..24164c379cd7 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 @@ -7,6 +7,7 @@ import com.azure.core.amqp.exception.AmqpErrorCondition; import com.azure.core.amqp.exception.AmqpErrorContext; import com.azure.core.amqp.exception.AmqpException; +import com.azure.messaging.servicebus.models.ReceiveMode; import org.apache.qpid.proton.message.Message; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; @@ -21,22 +22,31 @@ import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.reactivestreams.Subscription; -import reactor.core.Disposable; import reactor.core.publisher.DirectProcessor; import reactor.core.publisher.EmitterProcessor; import reactor.core.publisher.Flux; import reactor.core.publisher.FluxSink; import reactor.test.StepVerifier; +import reactor.test.publisher.TestPublisher; import java.time.Duration; +import java.util.concurrent.Semaphore; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Supplier; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; @@ -59,13 +69,10 @@ class ServiceBusReceiveLinkProcessorTest { private Message message1; @Mock private Message message2; - @Mock - private Disposable parentConnection; @Captor private ArgumentCaptor> creditSupplierCaptor; - private final AmqpErrorContext amqpErrorContext = new AmqpErrorContext("test-context"); private final EmitterProcessor endpointProcessor = EmitterProcessor.create(); private final EmitterProcessor messageProcessor = EmitterProcessor.create(); private final FluxSink messageProcessorSink = messageProcessor.sink(FluxSink.OverflowStrategy.BUFFER); @@ -85,7 +92,7 @@ static void afterAll() { void setup() { MockitoAnnotations.initMocks(this); - linkProcessor = new ServiceBusReceiveLinkProcessor(PREFETCH, retryPolicy, parentConnection, amqpErrorContext); + linkProcessor = new ServiceBusReceiveLinkProcessor(PREFETCH, retryPolicy, ReceiveMode.PEEK_LOCK); when(link1.getEndpointStates()).thenReturn(endpointProcessor); when(link1.receive()).thenReturn(messageProcessor); @@ -98,12 +105,12 @@ void teardown() { @Test void constructor() { - Assertions.assertThrows(NullPointerException.class, () -> new ServiceBusReceiveLinkProcessor(PREFETCH, null, - parentConnection, amqpErrorContext)); - Assertions.assertThrows(NullPointerException.class, () -> new ServiceBusReceiveLinkProcessor(PREFETCH, retryPolicy, - null, amqpErrorContext)); - Assertions.assertThrows(IllegalArgumentException.class, () -> new ServiceBusReceiveLinkProcessor(-1, retryPolicy, - parentConnection, amqpErrorContext)); + assertThrows(NullPointerException.class, () -> new ServiceBusReceiveLinkProcessor(PREFETCH, null, + ReceiveMode.PEEK_LOCK)); + assertThrows(IllegalArgumentException.class, () -> new ServiceBusReceiveLinkProcessor(-1, retryPolicy, + ReceiveMode.PEEK_LOCK)); + assertThrows(NullPointerException.class, () -> new ServiceBusReceiveLinkProcessor(PREFETCH, retryPolicy, + null)); } /** @@ -128,19 +135,20 @@ void createNewLink() { .thenCancel() .verify(); - Assertions.assertTrue(processor.isTerminated()); - Assertions.assertFalse(processor.hasError()); - Assertions.assertNull(processor.getError()); + assertTrue(processor.isTerminated()); + assertFalse(processor.hasError()); + assertNull(processor.getError()); verify(link1).addCredits(eq(PREFETCH)); verify(link1).setEmptyCreditListener(creditSupplierCaptor.capture()); Supplier value = creditSupplierCaptor.getValue(); - Assertions.assertNotNull(value); + assertNotNull(value); final Integer creditValue = value.get(); - // Expecting 1 because it is Long.MAX_VALUE. - assertEquals(1, creditValue); + // Expecting 5 because it is Long.MAX_VALUE and there are no credits (since we invoked the empty credit + // listener). + assertEquals(PREFETCH, creditValue); } /** @@ -161,11 +169,11 @@ void respectsBackpressureInRange() { .thenCancel() .verify(); - verify(link1).addCredits(eq(PREFETCH)); + verify(link1).addCredits(eq(backpressure)); verify(link1).setEmptyCreditListener(creditSupplierCaptor.capture()); Supplier value = creditSupplierCaptor.getValue(); - Assertions.assertNotNull(value); + assertNotNull(value); final Integer creditValue = value.get(); final int emittedOne = backpressure - 1; @@ -176,26 +184,33 @@ void respectsBackpressureInRange() { * Verifies we don't set the back pressure when it is too low. */ @Test - void respectsBackpressureLessThanMinimum() { + void respectsBackpressureLessThanMinimum() throws InterruptedException { // Arrange + final Semaphore semaphore = new Semaphore(1); final int backpressure = -1; ServiceBusReceiveLinkProcessor processor = Flux.create(sink -> sink.next(link1)) .subscribeWith(linkProcessor); when(link1.getCredits()).thenReturn(1); // Act + semaphore.acquire(); processor.subscribe( e -> System.out.println("message: " + e), Assertions::fail, () -> System.out.println("Complete."), - s -> s.request(backpressure)); + s -> { + s.request(backpressure); + semaphore.release(); + }); // Assert - verify(link1).addCredits(eq(PREFETCH)); + assertTrue(semaphore.tryAcquire(10, TimeUnit.SECONDS)); + + verify(link1, never()).addCredits(anyInt()); verify(link1).setEmptyCreditListener(creditSupplierCaptor.capture()); Supplier value = creditSupplierCaptor.getValue(); - Assertions.assertNotNull(value); + assertNotNull(value); final Integer creditValue = value.get(); // Expecting 0 because we wouldn't have any requested set. @@ -272,9 +287,9 @@ void newLinkOnClose() { }) .verifyComplete(); - Assertions.assertTrue(processor.isTerminated()); - Assertions.assertFalse(processor.hasError()); - Assertions.assertNull(processor.getError()); + assertTrue(processor.isTerminated()); + assertFalse(processor.hasError()); + assertNull(processor.getError()); } /** @@ -313,9 +328,9 @@ void newLinkOnRetryableError() { .thenCancel() .verify(); - Assertions.assertTrue(processor.isTerminated()); - Assertions.assertFalse(processor.hasError()); - Assertions.assertNull(processor.getError()); + assertTrue(processor.isTerminated()); + assertFalse(processor.hasError()); + assertNull(processor.getError()); } /** @@ -350,18 +365,18 @@ void nonRetryableError() { endpointSink.error(amqpException); }) .expectErrorSatisfies(error -> { - Assertions.assertTrue(error instanceof AmqpException); + assertTrue(error instanceof AmqpException); AmqpException exception = (AmqpException) error; - Assertions.assertFalse(exception.isTransient()); + assertFalse(exception.isTransient()); assertEquals(amqpException.getErrorCondition(), exception.getErrorCondition()); assertEquals(amqpException.getMessage(), exception.getMessage()); }) .verify(); - Assertions.assertTrue(processor.isTerminated()); - Assertions.assertTrue(processor.hasError()); - Assertions.assertSame(amqpException, processor.getError()); + assertTrue(processor.isTerminated()); + assertTrue(processor.hasError()); + assertSame(amqpException, processor.getError()); } /** @@ -438,52 +453,54 @@ void retriesUntilExhausted() { .then(() -> endpointSink.error(amqpException)) .thenAwait(delay) .then(() -> link2StateSink.error(amqpException2)) - .expectErrorSatisfies(error -> Assertions.assertSame(amqpException2, error)) + .expectErrorSatisfies(error -> assertSame(amqpException2, error)) .verify(); - Assertions.assertTrue(processor.isTerminated()); - Assertions.assertTrue(processor.hasError()); - Assertions.assertSame(amqpException2, processor.getError()); + assertTrue(processor.isTerminated()); + assertTrue(processor.hasError()); + assertSame(amqpException2, processor.getError()); } /** - * Does not request another link when parent connection is closed. + * Does not request another link when upstream is closed. */ @Test void doNotRetryWhenParentConnectionIsClosed() { // Arrange - final ServiceBusReceiveLink[] connections = new ServiceBusReceiveLink[]{link1, link2}; - - final ServiceBusReceiveLinkProcessor processor = createSink(connections).subscribeWith(linkProcessor); - final FluxSink endpointSink = endpointProcessor.sink(); + final TestPublisher linkGenerator = TestPublisher.create(); + final ServiceBusReceiveLinkProcessor processor = linkGenerator.flux().subscribeWith(linkProcessor); + final TestPublisher endpointStates = TestPublisher.create(); + final TestPublisher messages = TestPublisher.create(); - final DirectProcessor link2StateProcessor = DirectProcessor.create(); - - when(parentConnection.isDisposed()).thenReturn(true); + when(link1.getEndpointStates()).thenReturn(endpointStates.flux()); + when(link1.receive()).thenReturn(messages.flux()); - when(link2.getEndpointStates()).thenReturn(link2StateProcessor); + final TestPublisher endpointStates2 = TestPublisher.create(); + when(link2.getEndpointStates()).thenReturn(endpointStates2.flux()); when(link2.receive()).thenReturn(Flux.never()); // Act & Assert StepVerifier.create(processor) .then(() -> { - endpointSink.next(AmqpEndpointState.ACTIVE); - messageProcessorSink.next(message1); + linkGenerator.next(link1); + endpointStates.next(AmqpEndpointState.ACTIVE); + messages.next(message1); }) .expectNext(message1) - .then(() -> endpointSink.complete()) - .thenCancel() + .then(linkGenerator::complete) + .then(endpointStates::complete) + .expectComplete() .verify(); - Assertions.assertTrue(processor.isTerminated()); + assertTrue(processor.isTerminated()); } @Test void requiresNonNull() { - Assertions.assertThrows(NullPointerException.class, + assertThrows(NullPointerException.class, () -> linkProcessor.onNext(null)); - Assertions.assertThrows(NullPointerException.class, + assertThrows(NullPointerException.class, () -> linkProcessor.onError(null)); } @@ -533,19 +550,20 @@ void receivesUntilFirstLinkClosed() { .expectComplete() .verify(); - Assertions.assertTrue(processor.isTerminated()); - Assertions.assertFalse(processor.hasError()); - Assertions.assertNull(processor.getError()); + assertTrue(processor.isTerminated()); + assertFalse(processor.hasError()); + assertNull(processor.getError()); verify(link1).addCredits(eq(PREFETCH)); verify(link1).setEmptyCreditListener(creditSupplierCaptor.capture()); Supplier value = creditSupplierCaptor.getValue(); - Assertions.assertNotNull(value); + assertNotNull(value); final Integer creditValue = value.get(); - // Expecting 1 because it is Long.MAX_VALUE. - assertEquals(1, creditValue); + // Expecting 5 because it is Long.MAX_VALUE and there are no credits (since we invoked the empty credit + // listener). + assertEquals(PREFETCH, creditValue); } @Test @@ -568,19 +586,20 @@ void receivesFromFirstLink() { .thenCancel() .verify(); - Assertions.assertTrue(processor.isTerminated()); - Assertions.assertFalse(processor.hasError()); - Assertions.assertNull(processor.getError()); + assertTrue(processor.isTerminated()); + assertFalse(processor.hasError()); + assertNull(processor.getError()); verify(link1).addCredits(eq(PREFETCH)); verify(link1).setEmptyCreditListener(creditSupplierCaptor.capture()); Supplier value = creditSupplierCaptor.getValue(); - Assertions.assertNotNull(value); + assertNotNull(value); final Integer creditValue = value.get(); - // Expecting 1 because it is Long.MAX_VALUE. - assertEquals(1, creditValue); + // Expecting 5 because it is Long.MAX_VALUE and there are no credits (since we invoked the empty credit + // listener). + assertEquals(PREFETCH, creditValue); } /** @@ -591,10 +610,12 @@ void receivesFromFirstLink() { void backpressureRequestOnlyEmitsThatAmount() { // Arrange final int backpressure = 10; + final int existingCredits = 1; + final int expectedCredits = backpressure - existingCredits; ServiceBusReceiveLinkProcessor processor = Flux.just(link1).subscribeWith(linkProcessor); FluxSink sink = endpointProcessor.sink(); - when(link1.getCredits()).thenReturn(1); + when(link1.getCredits()).thenReturn(existingCredits); // Act & Assert StepVerifier.create(processor, backpressure) @@ -610,11 +631,11 @@ void backpressureRequestOnlyEmitsThatAmount() { .thenCancel() .verify(); - Assertions.assertTrue(processor.isTerminated()); - Assertions.assertFalse(processor.hasError()); - Assertions.assertNull(processor.getError()); + assertTrue(processor.isTerminated()); + assertFalse(processor.hasError()); + assertNull(processor.getError()); - verify(link1).addCredits(eq(PREFETCH)); + verify(link1).addCredits(expectedCredits); verify(link1).setEmptyCreditListener(any()); } diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/createQueue.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/createQueue.json index 7c25385d381c..3ace85d9edb2 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/createQueue.json +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/createQueue.json @@ -1,9 +1,9 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://REDACTED.servicebus.windows.net/test57869?api-version=2017-04", + "Uri" : "https://REDACTED.servicebus.windows.net/test18701?api-version=2017-04", "Headers" : { - "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10 10.0)", + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)", "Content-Type" : "application/xml" }, "Response" : { @@ -12,11 +12,11 @@ "Server" : "Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "201", - "Body" : "https://sb-java-conniey-5.servicebus.windows.net/test57869?api-version=2017-04test578692020-06-30T23:20:51Z2020-06-30T23:20:51Zsb-java-conniey-5test57869PT1M1024falsefalseP10675199DT2H48M5.4775807SfalsePT10M10true00falseActive2020-06-30T23:20:51.81Z2020-06-30T23:20:51.897ZtrueP10675199DT2H48M5.477SP10675199DT2H48M5.477SfalsePT2MtruefalsePT45S7500truetruesome-metadata-for-testingAvailablefalse", - "Date" : "Tue, 30 Jun 2020 23:20:52 GMT", + "Body" : "https://sb-java-conniey-1.servicebus.windows.net/test18701?api-version=2017-04test187012020-07-02T22:49:08Z2020-07-02T22:49:08Zsb-java-conniey-1test18701PT1M1024falsefalseP10675199DT2H48M5.4775807SfalsePT10M10true00falseActive2020-07-02T22:49:08.847Z2020-07-02T22:49:08.88ZtrueP10675199DT2H48M5.477SP10675199DT2H48M5.477SfalsePT2MtruefalsePT45S7500truetruesome-metadata-for-testingAvailablefalse", + "Date" : "Thu, 02 Jul 2020 22:49:08 GMT", "Content-Type" : "application/atom+xml;type=entry;charset=utf-8" }, "Exception" : null } ], - "variables" : [ "test57869" ] + "variables" : [ "test18701" ] } \ No newline at end of file diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/createQueueExistingName.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/createQueueExistingName.json index 9606c67998d3..d2c3884b5c86 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/createQueueExistingName.json +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/createQueueExistingName.json @@ -3,18 +3,18 @@ "Method" : "PUT", "Uri" : "https://REDACTED.servicebus.windows.net/queue-5?api-version=2017-04", "Headers" : { - "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.3 (11.0.5; Windows 10 10.0)", + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)", "Content-Type" : "application/xml" }, "Response" : { "Transfer-Encoding" : "chunked", "Strict-Transport-Security" : "max-age=31536000", "Server" : "Microsoft-HTTPAPI/2.0", - "ETag" : "637271971426770000", + "ETag" : "637293228523600000", "retry-after" : "0", "StatusCode" : "409", - "Body" : "409SubCode=40900. Conflict. You're requesting an operation that isn't allowed in the resource's current state. To know more visit https://aka.ms/sbResourceMgrExceptions. . TrackingId:6b1c42e7-0272-4499-9848-fb60303c56a7_G0, SystemTracker:sb-java-conniey-4.servicebus.windows.net:queue-5, Timestamp:2020-06-08T07:14:45", - "Date" : "Mon, 08 Jun 2020 07:14:45 GMT", + "Body" : "409SubCode=40900. Conflict. You're requesting an operation that isn't allowed in the resource's current state. To know more visit https://aka.ms/sbResourceMgrExceptions. . TrackingId:65bf6389-d9e3-48db-a037-528c71f0fcfa_G4, SystemTracker:sb-java-conniey-1.servicebus.windows.net:queue-5, Timestamp:2020-07-02T22:49:02", + "Date" : "Thu, 02 Jul 2020 22:49:02 GMT", "Content-Type" : "application/xml; charset=utf-8" }, "Exception" : null diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/createSubscription.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/createSubscription.json index d47d25104e88..ee7686e6357d 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/createSubscription.json +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/createSubscription.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://REDACTED.servicebus.windows.net/topic/subscriptions/sub042579?api-version=2017-04", + "Uri" : "https://REDACTED.servicebus.windows.net/topic-0/subscriptions/sub58016a?api-version=2017-04", "Headers" : { - "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10 10.0)", + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)", "Content-Type" : "application/xml" }, "Response" : { "Transfer-Encoding" : "chunked", "Strict-Transport-Security" : "max-age=31536000", "Server" : "Microsoft-HTTPAPI/2.0", - "ETag" : "637284664716270000", + "ETag" : "637293228524970000", "retry-after" : "0", "StatusCode" : "201", - "Body" : "https://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions/sub042579?api-version=2017-04sub0425792020-07-01T05:36:06Z2020-07-01T05:36:06ZPT45SfalseP10675199DT2H48M5.477Sfalsetrue07trueActive2020-07-01T05:36:06.6292417Z2020-07-01T05:36:06.6292417Z0001-01-01T00:00:00some-metadata-for-testing-subscriptionsP10675199DT2H48M5.477SAvailable", - "Date" : "Wed, 01 Jul 2020 05:36:08 GMT", + "Body" : "https://sb-java-conniey-1.servicebus.windows.net/topic-0/subscriptions/sub58016a?api-version=2017-04sub58016a2020-07-02T22:49:02Z2020-07-02T22:49:02ZPT45SfalseP10675199DT2H48M5.477Sfalsetrue07trueActive2020-07-02T22:49:02.1161757Z2020-07-02T22:49:02.1161757Z0001-01-01T00:00:00some-metadata-for-testing-subscriptionsP10675199DT2H48M5.477SAvailable", + "Date" : "Thu, 02 Jul 2020 22:49:01 GMT", "Content-Type" : "application/atom+xml;type=entry;charset=utf-8" }, "Exception" : null } ], - "variables" : [ "sub042579" ] + "variables" : [ "sub58016a" ] } \ No newline at end of file diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/createSubscriptionExistingName.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/createSubscriptionExistingName.json index cd6d4fbb0b91..0749288c9b7c 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/createSubscriptionExistingName.json +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/createSubscriptionExistingName.json @@ -1,20 +1,20 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://REDACTED.servicebus.windows.net/topic/subscriptions/subscription-session-1?api-version=2017-04", + "Uri" : "https://REDACTED.servicebus.windows.net/topic-1/subscriptions/subscription-session?api-version=2017-04", "Headers" : { - "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10 10.0)", + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)", "Content-Type" : "application/xml" }, "Response" : { "Transfer-Encoding" : "chunked", "Strict-Transport-Security" : "max-age=31536000", "Server" : "Microsoft-HTTPAPI/2.0", - "ETag" : "637284664716270000", + "ETag" : "637293228523500000", "retry-after" : "0", "StatusCode" : "409", - "Body" : "409Entity 'sb-java-conniey-5:Topic:topic|subscription-session-1' already exists. TrackingId:d57d27d9-ce2a-4c8e-ad10-3c81cf96f556_G6_B4, SystemTracker:sb-java-conniey-5:Topic:topic|subscription-session-1, Timestamp:2020-07-01T08:02:23", - "Date" : "Wed, 01 Jul 2020 08:02:23 GMT", + "Body" : "409Entity 'sb-java-conniey-1:Topic:topic-1|subscription-session' already exists. TrackingId:01769f7c-52a6-4783-88c1-1d7d49027d9a_G25_B7, SystemTracker:sb-java-conniey-1:Topic:topic-1|subscription-session, Timestamp:2020-07-03T00:43:40", + "Date" : "Fri, 03 Jul 2020 00:43:41 GMT", "Content-Type" : "application/xml; charset=utf-8" }, "Exception" : null diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/createTopicWithResponse.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/createTopicWithResponse.json index d192d4a456af..fd8af5149f18 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/createTopicWithResponse.json +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/createTopicWithResponse.json @@ -1,9 +1,9 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://REDACTED.servicebus.windows.net/test23290?api-version=2017-04", + "Uri" : "https://REDACTED.servicebus.windows.net/test50863?api-version=2017-04", "Headers" : { - "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10 10.0)", + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)", "Content-Type" : "application/xml" }, "Response" : { @@ -12,11 +12,11 @@ "Server" : "Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "201", - "Body" : "https://sb-java-conniey-5.servicebus.windows.net/test23290?api-version=2017-04test232902020-07-01T08:35:41Z2020-07-01T08:35:41Zsb-java-conniey-5test23290P10675199DT2H48M5.477S2048truePT2Mtrue0falsefalseActive2020-07-01T08:35:41.32Z2020-07-01T08:35:41.367ZfalseP10675199DT2H48M5.477Sfalsesome-metadata-for-testing-topicAvailablefalsefalse", - "Date" : "Wed, 01 Jul 2020 08:35:41 GMT", + "Body" : "https://sb-java-conniey-1.servicebus.windows.net/test50863?api-version=2017-04test508632020-07-02T22:49:12Z2020-07-02T22:49:12Zsb-java-conniey-1test50863P10675199DT2H48M5.477S2048truePT2Mtrue0falsefalseActive2020-07-02T22:49:12.47Z2020-07-02T22:49:12.56ZfalseP10675199DT2H48M5.477Sfalsesome-metadata-for-testing-topicAvailablefalsefalse", + "Date" : "Thu, 02 Jul 2020 22:49:12 GMT", "Content-Type" : "application/atom+xml;type=entry;charset=utf-8" }, "Exception" : null } ], - "variables" : [ "test23290" ] + "variables" : [ "test50863" ] } \ No newline at end of file diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/deleteQueue.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/deleteQueue.json index 65feca32e72b..b5ebc8f72128 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/deleteQueue.json +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/deleteQueue.json @@ -1,9 +1,9 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://REDACTED.servicebus.windows.net/sub535673?api-version=2017-04", + "Uri" : "https://REDACTED.servicebus.windows.net/sub389454?api-version=2017-04", "Headers" : { - "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10 10.0)", + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)", "Content-Type" : "application/xml" }, "Response" : { @@ -12,27 +12,27 @@ "Server" : "Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "201", - "Body" : "https://sb-java-conniey-5.servicebus.windows.net/sub535673?api-version=2017-04sub5356732020-07-01T06:42:09Z2020-07-01T06:42:09Zsb-java-conniey-5sub535673PT1M1024falsefalseP10675199DT2H48M5.4775807SfalsePT10M10true00falseActive2020-07-01T06:42:09.16Z2020-07-01T06:42:09.233ZtrueP10675199DT2H48M5.477SP10675199DT2H48M5.477SfalsePT1MtruefalsePT1M101024falsefalseAvailablefalse", - "Date" : "Wed, 01 Jul 2020 06:42:09 GMT", + "Body" : "https://sb-java-conniey-1.servicebus.windows.net/sub389454?api-version=2017-04sub3894542020-07-02T22:49:03Z2020-07-02T22:49:03Zsb-java-conniey-1sub389454PT1M1024falsefalseP10675199DT2H48M5.4775807SfalsePT10M10true00falseActive2020-07-02T22:49:03.04Z2020-07-02T22:49:03.087ZtrueP10675199DT2H48M5.477SP10675199DT2H48M5.477SfalsePT1MtruefalsePT1M101024falsefalseAvailablefalse", + "Date" : "Thu, 02 Jul 2020 22:49:03 GMT", "Content-Type" : "application/atom+xml;type=entry;charset=utf-8" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://REDACTED.servicebus.windows.net/sub535673?api-version=2017-04", + "Uri" : "https://REDACTED.servicebus.windows.net/sub389454?api-version=2017-04", "Headers" : { - "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10 10.0)" + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)" }, "Response" : { "Strict-Transport-Security" : "max-age=31536000", "Server" : "Microsoft-HTTPAPI/2.0", - "ETag" : "637291825292330000", + "ETag" : "637293269430870000", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "200", - "Date" : "Wed, 01 Jul 2020 06:42:10 GMT" + "Date" : "Thu, 02 Jul 2020 22:49:03 GMT" }, "Exception" : null } ], - "variables" : [ "sub535673" ] + "variables" : [ "sub389454" ] } \ No newline at end of file diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/deleteSubscription.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/deleteSubscription.json index 6cc5ec4b3f84..19855ceb0f49 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/deleteSubscription.json +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/deleteSubscription.json @@ -1,9 +1,9 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://REDACTED.servicebus.windows.net/topic97369?api-version=2017-04", + "Uri" : "https://REDACTED.servicebus.windows.net/topic08886?api-version=2017-04", "Headers" : { - "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10 10.0)", + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)", "Content-Type" : "application/xml" }, "Response" : { @@ -12,46 +12,46 @@ "Server" : "Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "201", - "Body" : "https://sb-java-conniey-5.servicebus.windows.net/topic97369?api-version=2017-04topic973692020-07-01T08:24:27Z2020-07-01T08:24:27Zsb-java-conniey-5topic97369P10675199DT2H48M5.477S1024falsePT1Mtrue0falsefalseActive2020-07-01T08:24:27.193Z2020-07-01T08:24:27.333ZfalseP10675199DT2H48M5.477SfalseAvailablefalsefalse", - "Date" : "Wed, 01 Jul 2020 08:24:27 GMT", + "Body" : "https://sb-java-conniey-1.servicebus.windows.net/topic08886?api-version=2017-04topic088862020-07-02T22:49:06Z2020-07-02T22:49:06Zsb-java-conniey-1topic08886P10675199DT2H48M5.477S1024falsePT1Mtrue0falsefalseActive2020-07-02T22:49:06.843Z2020-07-02T22:49:06.89ZfalseP10675199DT2H48M5.477SfalseAvailablefalsefalse", + "Date" : "Thu, 02 Jul 2020 22:49:06 GMT", "Content-Type" : "application/atom+xml;type=entry;charset=utf-8" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://REDACTED.servicebus.windows.net/topic97369/subscriptions/cc1d77b?api-version=2017-04", + "Uri" : "https://REDACTED.servicebus.windows.net/topic08886/subscriptions/5336d4f?api-version=2017-04", "Headers" : { - "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10 10.0)", + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)", "Content-Type" : "application/xml" }, "Response" : { "Transfer-Encoding" : "chunked", "Strict-Transport-Security" : "max-age=31536000", "Server" : "Microsoft-HTTPAPI/2.0", - "ETag" : "637291886673330000", + "ETag" : "637293269468900000", "retry-after" : "0", "StatusCode" : "201", - "Body" : "https://sb-java-conniey-5.servicebus.windows.net/topic97369/subscriptions/cc1d77b?api-version=2017-04cc1d77b2020-07-01T08:24:27Z2020-07-01T08:24:27ZPT1MfalseP10675199DT2H48M5.477Sfalsetrue010trueActive2020-07-01T08:24:27.8665339Z2020-07-01T08:24:27.8665339Z0001-01-01T00:00:00P10675199DT2H48M5.477SAvailable", - "Date" : "Wed, 01 Jul 2020 08:24:27 GMT", + "Body" : "https://sb-java-conniey-1.servicebus.windows.net/topic08886/subscriptions/5336d4f?api-version=2017-045336d4f2020-07-02T22:49:07Z2020-07-02T22:49:07ZPT1MfalseP10675199DT2H48M5.477Sfalsetrue010trueActive2020-07-02T22:49:07.3503133Z2020-07-02T22:49:07.3503133Z0001-01-01T00:00:00P10675199DT2H48M5.477SAvailable", + "Date" : "Thu, 02 Jul 2020 22:49:06 GMT", "Content-Type" : "application/atom+xml;type=entry;charset=utf-8" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://REDACTED.servicebus.windows.net/topic97369/subscriptions/cc1d77b?api-version=2017-04", + "Uri" : "https://REDACTED.servicebus.windows.net/topic08886/subscriptions/5336d4f?api-version=2017-04", "Headers" : { - "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10 10.0)" + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)" }, "Response" : { "Strict-Transport-Security" : "max-age=31536000", "Server" : "Microsoft-HTTPAPI/2.0", - "ETag" : "637291886673330000", + "ETag" : "637293269468900000", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "200", - "Date" : "Wed, 01 Jul 2020 08:24:27 GMT" + "Date" : "Thu, 02 Jul 2020 22:49:07 GMT" }, "Exception" : null } ], - "variables" : [ "topic97369", "cc1d77b" ] + "variables" : [ "topic08886", "5336d4f" ] } \ No newline at end of file diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/deleteTopic.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/deleteTopic.json index ec5a0b577ef9..91e904d2e9ec 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/deleteTopic.json +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/deleteTopic.json @@ -1,9 +1,9 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://REDACTED.servicebus.windows.net/topic50379?api-version=2017-04", + "Uri" : "https://REDACTED.servicebus.windows.net/topic00952?api-version=2017-04", "Headers" : { - "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10 10.0)", + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)", "Content-Type" : "application/xml" }, "Response" : { @@ -12,27 +12,27 @@ "Server" : "Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "201", - "Body" : "https://sb-java-conniey-5.servicebus.windows.net/topic50379?api-version=2017-04topic503792020-07-01T08:24:37Z2020-07-01T08:24:37Zsb-java-conniey-5topic50379P10675199DT2H48M5.477S1024falsePT1Mtrue0falsefalseActive2020-07-01T08:24:37.21Z2020-07-01T08:24:37.25ZfalseP10675199DT2H48M5.477SfalseAvailablefalsefalse", - "Date" : "Wed, 01 Jul 2020 08:24:37 GMT", + "Body" : "https://sb-java-conniey-1.servicebus.windows.net/topic00952?api-version=2017-04topic009522020-07-02T22:49:04Z2020-07-02T22:49:04Zsb-java-conniey-1topic00952P10675199DT2H48M5.477S1024falsePT1Mtrue0falsefalseActive2020-07-02T22:49:04.55Z2020-07-02T22:49:04.583ZfalseP10675199DT2H48M5.477SfalseAvailablefalsefalse", + "Date" : "Thu, 02 Jul 2020 22:49:04 GMT", "Content-Type" : "application/atom+xml;type=entry;charset=utf-8" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://REDACTED.servicebus.windows.net/topic50379?api-version=2017-04", + "Uri" : "https://REDACTED.servicebus.windows.net/topic00952?api-version=2017-04", "Headers" : { - "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10 10.0)" + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)" }, "Response" : { "Strict-Transport-Security" : "max-age=31536000", "Server" : "Microsoft-HTTPAPI/2.0", - "ETag" : "637291886772500000", + "ETag" : "637293269445830000", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "200", - "Date" : "Wed, 01 Jul 2020 08:24:38 GMT" + "Date" : "Thu, 02 Jul 2020 22:49:05 GMT" }, "Exception" : null } ], - "variables" : [ "topic50379" ] + "variables" : [ "topic00952" ] } \ No newline at end of file diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getNamespace.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getNamespace.json new file mode 100644 index 000000000000..73bafcec8476 --- /dev/null +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getNamespace.json @@ -0,0 +1,20 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.servicebus.windows.net/$namespaceinfo?api-version=2017-04", + "Headers" : { + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "https://shivangiservicebus.servicebus.windows.net/$namespaceinfo?api-version=2017-04ShivangiServiceBus2020-07-02T09:53:19ZShivangiServiceBusServiceBusFallback2020-04-09T08:38:55.807ZPremium12020-06-12T06:34:38.383ZShivangiServiceBusMessaging", + "Date" : "Thu, 02 Jul 2020 09:53:19 GMT", + "Content-Type" : "application/atom+xml;type=entry;charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getQueue.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getQueue.json index 1d3e1e91689c..eb1af06a5f43 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getQueue.json +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getQueue.json @@ -3,17 +3,17 @@ "Method" : "GET", "Uri" : "https://REDACTED.servicebus.windows.net/queue-5?enrich=true&api-version=2017-04", "Headers" : { - "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.3 (11.0.5; Windows 10 10.0)" + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)" }, "Response" : { "Transfer-Encoding" : "chunked", "Strict-Transport-Security" : "max-age=31536000", "Server" : "Microsoft-HTTPAPI/2.0", - "ETag" : "637271971426770000", + "ETag" : "637293228523600000", "retry-after" : "0", "StatusCode" : "200", - "Body" : "https://sb-java-conniey-4.servicebus.windows.net/queue-5?enrich=true&api-version=2017-04queue-52020-06-08T07:12:22Z2020-06-08T07:12:22Zsb-java-conniey-4queue-5PT1M1024falsefalseP10675199DT2H48M5.4775807SfalsePT10M10true00falseActive2020-06-08T07:12:22.49067Z2020-06-08T07:12:22.49067Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalse", - "Date" : "Mon, 08 Jun 2020 07:14:59 GMT", + "Body" : "https://sb-java-conniey-1.servicebus.windows.net/queue-5?enrich=true&api-version=2017-04queue-52020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.3370279Z2020-07-02T21:40:52.3370279Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalse", + "Date" : "Thu, 02 Jul 2020 22:49:16 GMT", "Content-Type" : "application/atom+xml;type=entry;charset=utf-8" }, "Exception" : null diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getQueueDoesNotExist.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getQueueDoesNotExist.json index 89d8eaec5204..b97f5ee093ea 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getQueueDoesNotExist.json +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getQueueDoesNotExist.json @@ -1,9 +1,9 @@ { "networkCallRecords" : [ { "Method" : "GET", - "Uri" : "https://REDACTED.servicebus.windows.net/exist59740?enrich=true&api-version=2017-04", + "Uri" : "https://REDACTED.servicebus.windows.net/exist85316?enrich=true&api-version=2017-04", "Headers" : { - "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10 10.0)" + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -11,11 +11,11 @@ "Server" : "Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "Body" : "Publicly Listed ServicesThis is the list of publicly-listed services currently available.uuid:d4b3e5c3-871a-4c95-8ef2-16f787517690;id=72842020-07-02T04:54:10ZService Bus 1.1", - "Date" : "Thu, 02 Jul 2020 04:54:10 GMT", + "Body" : "Publicly Listed ServicesThis is the list of publicly-listed services currently available.uuid:b2a5260d-7d50-405b-9cc5-d5e365e93c0b;id=44852020-07-02T22:49:06ZService Bus 1.1", + "Date" : "Thu, 02 Jul 2020 22:49:05 GMT", "Content-Type" : "application/atom+xml;type=feed;charset=utf-8" }, "Exception" : null } ], - "variables" : [ "exist59740" ] + "variables" : [ "exist85316" ] } \ No newline at end of file diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getQueueExists.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getQueueExists.json new file mode 100644 index 000000000000..06b0cfaf56d9 --- /dev/null +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getQueueExists.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.servicebus.windows.net/queue-2?enrich=true&api-version=2017-04", + "Headers" : { + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Strict-Transport-Security" : "max-age=31536000", + "Server" : "Microsoft-HTTPAPI/2.0", + "ETag" : "637293228523500000", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "https://sb-java-conniey-1.servicebus.windows.net/queue-2?enrich=true&api-version=2017-04queue-22020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.24Z2020-07-02T21:40:52.35Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalse", + "Date" : "Thu, 02 Jul 2020 22:49:02 GMT", + "Content-Type" : "application/atom+xml;type=entry;charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getQueueExistsFalse.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getQueueExistsFalse.json new file mode 100644 index 000000000000..0beb821c5acb --- /dev/null +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getQueueExistsFalse.json @@ -0,0 +1,21 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.servicebus.windows.net/exist62239?enrich=true&api-version=2017-04", + "Headers" : { + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Strict-Transport-Security" : "max-age=31536000", + "Server" : "Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "Publicly Listed ServicesThis is the list of publicly-listed services currently available.uuid:b2a5260d-7d50-405b-9cc5-d5e365e93c0b;id=44872020-07-02T22:49:15ZService Bus 1.1", + "Date" : "Thu, 02 Jul 2020 22:49:15 GMT", + "Content-Type" : "application/atom+xml;type=feed;charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ "exist62239" ] +} \ No newline at end of file diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getQueueRuntimeInfo.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getQueueRuntimeInfo.json index 73b2425acac8..193cd5a28e54 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getQueueRuntimeInfo.json +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getQueueRuntimeInfo.json @@ -3,17 +3,17 @@ "Method" : "GET", "Uri" : "https://REDACTED.servicebus.windows.net/queue-2?enrich=true&api-version=2017-04", "Headers" : { - "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10 10.0)" + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)" }, "Response" : { "Transfer-Encoding" : "chunked", "Strict-Transport-Security" : "max-age=31536000", "Server" : "Microsoft-HTTPAPI/2.0", - "ETag" : "637284664716230000", + "ETag" : "637293228523500000", "retry-after" : "0", "StatusCode" : "200", - "Body" : "https://sb-java-conniey-5.servicebus.windows.net/queue-2?enrich=true&api-version=2017-04queue-22020-06-22T23:47:51Z2020-06-22T23:47:51Zsb-java-conniey-5PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-06-22T23:47:51.59Z2020-06-22T23:47:51.623Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalse", - "Date" : "Wed, 01 Jul 2020 05:31:41 GMT", + "Body" : "https://sb-java-conniey-1.servicebus.windows.net/queue-2?enrich=true&api-version=2017-04queue-22020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.24Z2020-07-02T21:40:52.35Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalse", + "Date" : "Thu, 02 Jul 2020 22:49:11 GMT", "Content-Type" : "application/atom+xml;type=entry;charset=utf-8" }, "Exception" : null diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getSubscription.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getSubscription.json index 774a4b8bc298..50e3c020ba9e 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getSubscription.json +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getSubscription.json @@ -1,19 +1,19 @@ { "networkCallRecords" : [ { "Method" : "GET", - "Uri" : "https://REDACTED.servicebus.windows.net/topic/subscriptions/subscription-session-1?enrich=true&api-version=2017-04", + "Uri" : "https://REDACTED.servicebus.windows.net/topic-1/subscriptions/subscription-session?enrich=true&api-version=2017-04", "Headers" : { - "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10 10.0)" + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)" }, "Response" : { "Transfer-Encoding" : "chunked", "Strict-Transport-Security" : "max-age=31536000", "Server" : "Microsoft-HTTPAPI/2.0", - "ETag" : "637284664716270000", + "ETag" : "637293228523500000", "retry-after" : "0", "StatusCode" : "200", - "Body" : "sb://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions/subscription-session-1?enrich=true&api-version=2017-04subscription-session-12020-06-22T23:47:54Z2020-06-22T23:47:54ZPT15StrueP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-06-22T23:47:54.0131447Z2020-06-22T23:47:54.0131447Z2020-06-22T23:47:54.013Z00000P10675199DT2H48M5.4775807SAvailable", - "Date" : "Tue, 30 Jun 2020 13:43:40 GMT", + "Body" : "sb://sb-java-conniey-1.servicebus.windows.net/topic-1/subscriptions/subscription-session?enrich=true&api-version=2017-04subscription-session2020-07-02T21:40:54Z2020-07-02T21:40:54ZPT15StrueP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-07-02T21:40:54.4327719Z2020-07-02T21:40:54.4327719Z2020-07-02T21:40:54.433Z00000P10675199DT2H48M5.4775807SAvailable", + "Date" : "Thu, 02 Jul 2020 22:49:16 GMT", "Content-Type" : "application/atom+xml;type=entry;charset=utf-8" }, "Exception" : null diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getSubscriptionDoesNotExist.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getSubscriptionDoesNotExist.json index 5a3f695505ae..8e027fcb194a 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getSubscriptionDoesNotExist.json +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getSubscriptionDoesNotExist.json @@ -1,19 +1,19 @@ { "networkCallRecords" : [ { "Method" : "GET", - "Uri" : "https://REDACTED.servicebus.windows.net/topic/subscriptions/subscription-session-not-exist?enrich=true&api-version=2017-04", + "Uri" : "https://REDACTED.servicebus.windows.net/topic-1/subscriptions/subscription-session-not-exist?enrich=true&api-version=2017-04", "Headers" : { - "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10 10.0)" + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)" }, "Response" : { "Transfer-Encoding" : "chunked", "Strict-Transport-Security" : "max-age=31536000", "Server" : "Microsoft-HTTPAPI/2.0", - "ETag" : "637284664716270000", + "ETag" : "637293228523500000", "retry-after" : "0", "StatusCode" : "404", - "Body" : "404Entity 'sb-java-conniey-5:Topic:topic|subscription-session-not-exist' was not found. To know more visit https://aka.ms/sbResourceMgrExceptions. TrackingId:58eae106-2499-454f-8fd7-748ef7803df4_B4, SystemTracker:NoSystemTracker, Timestamp:2020-06-30T13:47:32", - "Date" : "Tue, 30 Jun 2020 13:47:32 GMT", + "Body" : "404Entity 'sb-java-conniey-1:Topic:topic-1|subscription-session-not-exist' was not found. To know more visit https://aka.ms/sbResourceMgrExceptions. TrackingId:9a4e86d9-f739-40ec-b310-1b5cf6785c4c_B7, SystemTracker:NoSystemTracker, Timestamp:2020-07-02T22:49:10", + "Date" : "Thu, 02 Jul 2020 22:49:10 GMT", "Content-Type" : "application/xml; charset=utf-8" }, "Exception" : null diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getSubscriptionExists.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getSubscriptionExists.json new file mode 100644 index 000000000000..553aee2e0bc6 --- /dev/null +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getSubscriptionExists.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.servicebus.windows.net/topic-1/subscriptions/subscription-session?enrich=true&api-version=2017-04", + "Headers" : { + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Strict-Transport-Security" : "max-age=31536000", + "Server" : "Microsoft-HTTPAPI/2.0", + "ETag" : "637293228523500000", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "sb://sb-java-conniey-1.servicebus.windows.net/topic-1/subscriptions/subscription-session?enrich=true&api-version=2017-04subscription-session2020-07-02T21:40:54Z2020-07-02T21:40:54ZPT15StrueP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-07-02T21:40:54.4327719Z2020-07-02T21:40:54.4327719Z2020-07-02T21:40:54.433Z00000P10675199DT2H48M5.4775807SAvailable", + "Date" : "Thu, 02 Jul 2020 22:49:02 GMT", + "Content-Type" : "application/atom+xml;type=entry;charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getSubscriptionExistsFalse.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getSubscriptionExistsFalse.json new file mode 100644 index 000000000000..d7134c255b45 --- /dev/null +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getSubscriptionExistsFalse.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.servicebus.windows.net/topic-1/subscriptions/subscription-session-not-exist?enrich=true&api-version=2017-04", + "Headers" : { + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Strict-Transport-Security" : "max-age=31536000", + "Server" : "Microsoft-HTTPAPI/2.0", + "ETag" : "637293228523500000", + "retry-after" : "0", + "StatusCode" : "404", + "Body" : "404Entity 'sb-java-conniey-1:Topic:topic-1|subscription-session-not-exist' was not found. To know more visit https://aka.ms/sbResourceMgrExceptions. TrackingId:22b5c9e6-e962-4ba3-8a3b-078a4f7070ac_B7, SystemTracker:NoSystemTracker, Timestamp:2020-07-02T22:49:14", + "Date" : "Thu, 02 Jul 2020 22:49:14 GMT", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getSubscriptionRuntimeInfo.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getSubscriptionRuntimeInfo.json index 883e2cd490ed..496404f7fd07 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getSubscriptionRuntimeInfo.json +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getSubscriptionRuntimeInfo.json @@ -1,19 +1,19 @@ { "networkCallRecords" : [ { "Method" : "GET", - "Uri" : "https://REDACTED.servicebus.windows.net/topic/subscriptions/subscription-1?enrich=true&api-version=2017-04", + "Uri" : "https://REDACTED.servicebus.windows.net/topic-1/subscriptions/subscription-session?enrich=true&api-version=2017-04", "Headers" : { - "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10 10.0)" + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)" }, "Response" : { "Transfer-Encoding" : "chunked", "Strict-Transport-Security" : "max-age=31536000", "Server" : "Microsoft-HTTPAPI/2.0", - "ETag" : "637284664716270000", + "ETag" : "637293228523500000", "retry-after" : "0", "StatusCode" : "200", - "Body" : "sb://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions/subscription-1?enrich=true&api-version=2017-04subscription-12020-06-22T23:47:53Z2020-06-22T23:47:53ZPT15SfalseP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-06-22T23:47:53.9193827Z2020-06-22T23:47:53.9193827Z2020-06-22T23:47:53.92Z00000P10675199DT2H48M5.4775807SAvailable", - "Date" : "Tue, 30 Jun 2020 13:52:14 GMT", + "Body" : "sb://sb-java-conniey-1.servicebus.windows.net/topic-1/subscriptions/subscription-session?enrich=true&api-version=2017-04subscription-session2020-07-02T21:40:54Z2020-07-02T21:40:54ZPT15StrueP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-07-02T21:40:54.4327719Z2020-07-02T21:40:54.4327719Z2020-07-02T21:40:54.433Z00000P10675199DT2H48M5.4775807SAvailable", + "Date" : "Thu, 02 Jul 2020 22:49:10 GMT", "Content-Type" : "application/atom+xml;type=entry;charset=utf-8" }, "Exception" : null diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getTopic.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getTopic.json index 3d3b412ba003..b65dc0947dae 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getTopic.json +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getTopic.json @@ -1,19 +1,19 @@ { "networkCallRecords" : [ { "Method" : "GET", - "Uri" : "https://REDACTED.servicebus.windows.net/topic?enrich=true&api-version=2017-04", + "Uri" : "https://REDACTED.servicebus.windows.net/topic-1?enrich=true&api-version=2017-04", "Headers" : { - "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10 10.0)" + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)" }, "Response" : { "Transfer-Encoding" : "chunked", "Strict-Transport-Security" : "max-age=31536000", "Server" : "Microsoft-HTTPAPI/2.0", - "ETag" : "637284664716270000", + "ETag" : "637293228523500000", "retry-after" : "0", "StatusCode" : "200", - "Body" : "https://sb-java-conniey-5.servicebus.windows.net/topic?enrich=true&api-version=2017-04topic2020-06-22T23:47:51Z2020-06-22T23:47:51Zsb-java-conniey-5P10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2020-06-22T23:47:51.5889285Z2020-06-22T23:47:51.5889285Z2020-07-01T02:09:02.547Ztrue0000022P10675199DT2H48M5.4775807SfalseAvailablefalsefalse", - "Date" : "Wed, 01 Jul 2020 02:49:37 GMT", + "Body" : "https://sb-java-conniey-1.servicebus.windows.net/topic-1?enrich=true&api-version=2017-04topic-12020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1P10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2020-07-02T21:40:52.3077409Z2020-07-02T21:40:52.3077409Z2020-07-02T22:46:04.6172301Ztrue000003P10675199DT2H48M5.4775807SfalseAvailablefalsefalse", + "Date" : "Thu, 02 Jul 2020 22:49:16 GMT", "Content-Type" : "application/atom+xml;type=entry;charset=utf-8" }, "Exception" : null diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getTopicDoesNotExist.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getTopicDoesNotExist.json index cf1b29bba153..f8a17fbabe8a 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getTopicDoesNotExist.json +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getTopicDoesNotExist.json @@ -1,9 +1,9 @@ { "networkCallRecords" : [ { "Method" : "GET", - "Uri" : "https://REDACTED.servicebus.windows.net/9a4414fd96?enrich=true&api-version=2017-04", + "Uri" : "https://REDACTED.servicebus.windows.net/17d2b79d41?enrich=true&api-version=2017-04", "Headers" : { - "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10 10.0)" + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -11,11 +11,11 @@ "Server" : "Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "Body" : "Publicly Listed ServicesThis is the list of publicly-listed services currently available.uuid:65633c11-6bf9-4e64-914e-1dcafd13339b;id=15972020-07-02T05:13:31ZService Bus 1.1", - "Date" : "Thu, 02 Jul 2020 05:13:30 GMT", + "Body" : "Publicly Listed ServicesThis is the list of publicly-listed services currently available.uuid:b2a5260d-7d50-405b-9cc5-d5e365e93c0b;id=44862020-07-02T22:49:08ZService Bus 1.1", + "Date" : "Thu, 02 Jul 2020 22:49:07 GMT", "Content-Type" : "application/atom+xml;type=feed;charset=utf-8" }, "Exception" : null } ], - "variables" : [ "9a4414fd96" ] + "variables" : [ "17d2b79d41" ] } \ No newline at end of file diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getTopicExists.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getTopicExists.json new file mode 100644 index 000000000000..2ed7e3cb6f15 --- /dev/null +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getTopicExists.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.servicebus.windows.net/topic-1?enrich=true&api-version=2017-04", + "Headers" : { + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Strict-Transport-Security" : "max-age=31536000", + "Server" : "Microsoft-HTTPAPI/2.0", + "ETag" : "637293228523500000", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "https://sb-java-conniey-1.servicebus.windows.net/topic-1?enrich=true&api-version=2017-04topic-12020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1P10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2020-07-02T21:40:52.3077409Z2020-07-02T21:40:52.3077409Z2020-07-02T22:46:04.6172301Ztrue000003P10675199DT2H48M5.4775807SfalseAvailablefalsefalse", + "Date" : "Thu, 02 Jul 2020 22:49:02 GMT", + "Content-Type" : "application/atom+xml;type=entry;charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getTopicExistsFalse.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getTopicExistsFalse.json new file mode 100644 index 000000000000..2d54bf601dc5 --- /dev/null +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getTopicExistsFalse.json @@ -0,0 +1,21 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.servicebus.windows.net/f930478c6f?enrich=true&api-version=2017-04", + "Headers" : { + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Strict-Transport-Security" : "max-age=31536000", + "Server" : "Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "Publicly Listed ServicesThis is the list of publicly-listed services currently available.uuid:b2a5260d-7d50-405b-9cc5-d5e365e93c0b;id=44882020-07-02T22:49:16ZService Bus 1.1", + "Date" : "Thu, 02 Jul 2020 22:49:16 GMT", + "Content-Type" : "application/atom+xml;type=feed;charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ "f930478c6f" ] +} \ No newline at end of file diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getTopicRuntimeInfo.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getTopicRuntimeInfo.json index a0a645bff3f7..2f8a18b5cf1c 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getTopicRuntimeInfo.json +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/getTopicRuntimeInfo.json @@ -1,19 +1,19 @@ { "networkCallRecords" : [ { "Method" : "GET", - "Uri" : "https://REDACTED.servicebus.windows.net/topic?enrich=true&api-version=2017-04", + "Uri" : "https://REDACTED.servicebus.windows.net/topic-1?enrich=true&api-version=2017-04", "Headers" : { - "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10 10.0)" + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)" }, "Response" : { "Transfer-Encoding" : "chunked", "Strict-Transport-Security" : "max-age=31536000", "Server" : "Microsoft-HTTPAPI/2.0", - "ETag" : "637284664716270000", + "ETag" : "637293228523500000", "retry-after" : "0", "StatusCode" : "200", - "Body" : "https://sb-java-conniey-5.servicebus.windows.net/topic?enrich=true&api-version=2017-04topic2020-06-22T23:47:51Z2020-06-22T23:47:51Zsb-java-conniey-5P10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2020-06-22T23:47:51.543Z2020-06-22T23:47:51.627Z2020-07-01T02:09:02.547Ztrue0000022P10675199DT2H48M5.4775807SfalseAvailablefalsefalse", - "Date" : "Wed, 01 Jul 2020 03:24:20 GMT", + "Body" : "https://sb-java-conniey-1.servicebus.windows.net/topic-1?enrich=true&api-version=2017-04topic-12020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1P10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2020-07-02T21:40:52.3077409Z2020-07-02T21:40:52.3077409Z2020-07-02T22:46:04.6172301Ztrue000003P10675199DT2H48M5.4775807SfalseAvailablefalsefalse", + "Date" : "Thu, 02 Jul 2020 22:49:11 GMT", "Content-Type" : "application/atom+xml;type=entry;charset=utf-8" }, "Exception" : null diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/listQueues.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/listQueues.json index 801f5d5e6ae0..56e90a977d16 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/listQueues.json +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/listQueues.json @@ -3,18 +3,18 @@ "Method" : "GET", "Uri" : "https://REDACTED.servicebus.windows.net/$Resources/queues?$skip=0&$top=100&api-version=2017-04", "Headers" : { - "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10 10.0)" + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)" }, "Response" : { "Transfer-Encoding" : "chunked", "Server" : "Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "Body" : "Queueshttps://sb-java-conniey-5.servicebus.windows.net/$Resources/queues?$skip=0&$top=10&api-version=2017-042020-07-01T08:42:23Zhttps://sb-java-conniey-5.servicebus.windows.net/queue-0?api-version=2017-04queue-02020-06-22T23:47:51Z2020-06-22T23:47:51Zsb-java-conniey-5PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-06-22T23:47:51.53Z2020-06-22T23:47:51.577Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-5.servicebus.windows.net/queue-1?api-version=2017-04queue-12020-06-22T23:47:51Z2020-06-22T23:47:51Zsb-java-conniey-5PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-06-22T23:47:51.333Z2020-06-22T23:47:51.37Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-5.servicebus.windows.net/queue-2?api-version=2017-04queue-22020-06-22T23:47:51Z2020-06-22T23:47:51Zsb-java-conniey-5PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-06-22T23:47:51.59Z2020-06-22T23:47:51.623Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-5.servicebus.windows.net/queue-3?api-version=2017-04queue-32020-06-22T23:47:51Z2020-06-22T23:47:51Zsb-java-conniey-5PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-06-22T23:47:51.447Z2020-06-22T23:47:51.547Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-5.servicebus.windows.net/queue-4?api-version=2017-04queue-42020-06-22T23:47:51Z2020-06-22T23:47:51Zsb-java-conniey-5PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-06-22T23:47:51.513Z2020-06-22T23:47:51.59Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-5.servicebus.windows.net/queue-5?api-version=2017-04queue-52020-06-22T23:47:51Z2020-06-22T23:47:51Zsb-java-conniey-5PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-06-22T23:47:51.477Z2020-06-22T23:47:51.583Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-5.servicebus.windows.net/queue-6?api-version=2017-04queue-62020-06-22T23:47:51Z2020-06-22T23:47:51Zsb-java-conniey-5PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-06-22T23:47:51.65Z2020-06-22T23:47:51.737Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-5.servicebus.windows.net/queue-7?api-version=2017-04queue-72020-06-22T23:47:51Z2020-06-22T23:47:51Zsb-java-conniey-5PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-06-22T23:47:51.51Z2020-06-22T23:47:51.55Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-5.servicebus.windows.net/queue-8?api-version=2017-04queue-82020-06-22T23:47:51Z2020-06-22T23:47:51Zsb-java-conniey-5PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-06-22T23:47:51.49Z2020-06-22T23:47:51.517Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-5.servicebus.windows.net/queue-9?api-version=2017-04queue-92020-06-22T23:47:51Z2020-06-22T23:47:51Zsb-java-conniey-5PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-06-22T23:47:51.617Z2020-06-22T23:47:51.677Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalse", - "Date" : "Wed, 01 Jul 2020 08:42:23 GMT", + "Body" : "Queueshttps://sb-java-conniey-1.servicebus.windows.net/$Resources/queues?$skip=0&$top=100&api-version=2017-042020-07-02T22:49:12Zhttps://sb-java-conniey-1.servicebus.windows.net/queue-0?api-version=2017-04queue-02020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.4796634Z2020-07-02T21:40:52.4796634Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-1?api-version=2017-04queue-12020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.6202434Z2020-07-02T21:40:52.6202434Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-10?api-version=2017-04queue-102020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.3885816Z2020-07-02T21:40:52.3885816Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-11?api-version=2017-04queue-112020-07-02T21:40:52Z2020-07-02T21:40:53Zsb-java-conniey-1PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.4602371Z2020-07-02T21:40:52.4602371Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-12?api-version=2017-04queue-122020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.303Z2020-07-02T21:40:52.38Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-13?api-version=2017-04queue-132020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.3729319Z2020-07-02T21:40:52.3729319Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-14?api-version=2017-04queue-142020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.3858911Z2020-07-02T21:40:52.3858911Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-2?api-version=2017-04queue-22020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.24Z2020-07-02T21:40:52.35Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-3?api-version=2017-04queue-32020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.433Z2020-07-02T21:40:52.537Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-4?api-version=2017-04queue-42020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.1961838Z2020-07-02T21:40:52.1961838Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-5?api-version=2017-04queue-52020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.3370279Z2020-07-02T21:40:52.3370279Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-6?api-version=2017-04queue-62020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.1805873Z2020-07-02T21:40:52.1805873Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-7?api-version=2017-04queue-72020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.3504462Z2020-07-02T21:40:52.3504462Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-8?api-version=2017-04queue-82020-07-02T21:41:08Z2020-07-02T21:41:08Zsb-java-conniey-1PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:41:08.377Z2020-07-02T21:41:08.657Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-9?api-version=2017-04queue-92020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsefalseP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.3077433Z2020-07-02T21:40:52.3077433Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-session-0?api-version=2017-04queue-session-02020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsetrueP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.3546567Z2020-07-02T21:40:52.3546567Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-session-1?api-version=2017-04queue-session-12020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsetrueP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.4600522Z2020-07-02T21:40:52.4600522Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-session-10?api-version=2017-04queue-session-102020-07-02T21:40:53Z2020-07-02T21:40:53Zsb-java-conniey-1PT15S5120falsetrueP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:53.35Z2020-07-02T21:40:53.527Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-session-11?api-version=2017-04queue-session-112020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsetrueP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.4444348Z2020-07-02T21:40:52.4444348Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-session-12?api-version=2017-04queue-session-122020-07-02T21:40:52Z2020-07-02T21:40:53Zsb-java-conniey-1PT15S5120falsetrueP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.203Z2020-07-02T21:40:53.55Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-session-13?api-version=2017-04queue-session-132020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsetrueP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.34Z2020-07-02T21:40:52.403Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-session-14?api-version=2017-04queue-session-142020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsetrueP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.4667131Z2020-07-02T21:40:52.4667131Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-session-2?api-version=2017-04queue-session-22020-07-02T21:41:08Z2020-07-02T21:41:08Zsb-java-conniey-1PT15S5120falsetrueP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:41:08.357Z2020-07-02T21:41:08.413Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-session-3?api-version=2017-04queue-session-32020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsetrueP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.495492Z2020-07-02T21:40:52.495492Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-session-4?api-version=2017-04queue-session-42020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsetrueP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.3389907Z2020-07-02T21:40:52.3389907Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-session-5?api-version=2017-04queue-session-52020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsetrueP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.3975343Z2020-07-02T21:40:52.3975343Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-session-6?api-version=2017-04queue-session-62020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsetrueP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.223Z2020-07-02T21:40:52.333Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-session-7?api-version=2017-04queue-session-72020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsetrueP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.3702406Z2020-07-02T21:40:52.3702406Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-session-8?api-version=2017-04queue-session-82020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsetrueP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.2693699Z2020-07-02T21:40:52.2693699Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/queue-session-9?api-version=2017-04queue-session-92020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1PT15S5120falsetrueP10675199DT2H48M5.4775807SfalsePT10M5true00falseActive2020-07-02T21:40:52.3017253Z2020-07-02T21:40:52.3017253Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.4775807SfalseAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/test18548?api-version=2017-04test185482020-07-02T22:46:50Z2020-07-02T22:46:50Zsb-java-conniey-1test18548PT1M1024falsefalseP10675199DT2H48M5.4775807SfalsePT10M10true00falseActive2020-07-02T22:46:50.3845816Z2020-07-02T22:46:50.3845816Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.477SP10675199DT2H48M5.477SfalsePT2MtruefalsePT45S7500truetruesome-metadata-for-testingAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/test18701?api-version=2017-04test187012020-07-02T22:49:08Z2020-07-02T22:49:08Zsb-java-conniey-1test18701PT1M1024falsefalseP10675199DT2H48M5.4775807SfalsePT10M10true00falseActive2020-07-02T22:49:08.847Z2020-07-02T22:49:08.88Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.477SP10675199DT2H48M5.477SfalsePT2MtruefalsePT45S7500truetruesome-metadata-for-testingAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/test19144?api-version=2017-04test191442020-07-02T21:56:09Z2020-07-02T21:56:09Zsb-java-conniey-1test19144PT1M1024falsefalseP10675199DT2H48M5.4775807SfalsePT10M10true00falseActive2020-07-02T21:56:09.6119571Z2020-07-02T21:56:09.6119571Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.477SP10675199DT2H48M5.477SfalsePT2MtruefalsePT45S7500truetruesome-metadata-for-testingAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/test32991?api-version=2017-04test329912020-07-02T22:46:03Z2020-07-02T22:46:04Zsb-java-conniey-1test32991PT1M1024falsefalseP10675199DT2H48M5.4775807SfalsePT10M10true00falseActive2020-07-02T22:46:03.9926076Z2020-07-02T22:46:03.9926076Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.477SP10675199DT2H48M5.477SfalsePT2MtruefalsePT45S7500truetruesome-metadata-for-testingAvailablefalsehttps://sb-java-conniey-1.servicebus.windows.net/test71064?api-version=2017-04test710642020-07-02T22:40:12Z2020-07-02T22:40:12Zsb-java-conniey-1test71064PT1M1024falsefalseP10675199DT2H48M5.4775807SfalsePT10M10true00falseActive2020-07-02T22:40:12.35045Z2020-07-02T22:40:12.35045Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.477SP10675199DT2H48M5.477SfalsePT2MtruefalsePT45S7500truetruesome-metadata-for-testingAvailablefalse", + "Date" : "Thu, 02 Jul 2020 22:49:11 GMT", "Content-Type" : "application/atom+xml;type=feed;charset=utf-8" }, "Exception" : null } ], "variables" : [ ] -} +} \ No newline at end of file diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/listSubscriptions.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/listSubscriptions.json index cd281b8d123c..e5724b9f690b 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/listSubscriptions.json +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/listSubscriptions.json @@ -1,19 +1,19 @@ { "networkCallRecords" : [ { "Method" : "GET", - "Uri" : "https://REDACTED.servicebus.windows.net/topic/subscriptions?$skip=0&$top=100&api-version=2017-04", + "Uri" : "https://REDACTED.servicebus.windows.net/topic-1/subscriptions?$skip=0&$top=100&api-version=2017-04", "Headers" : { - "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10 10.0)" + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)" }, "Response" : { "Transfer-Encoding" : "chunked", "Strict-Transport-Security" : "max-age=31536000", "Server" : "Microsoft-HTTPAPI/2.0", - "ETag" : "637284664716270000", + "ETag" : "637293228523500000", "retry-after" : "0", "StatusCode" : "200", - "Body" : "Subscriptionshttps://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions?$skip=0&$top=100&api-version=2017-042020-07-01T11:40:51Zhttps://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions/sub042579?api-version=2017-04sub0425792020-07-01T05:36:06Z2020-07-01T05:36:06ZPT45SfalseP10675199DT2H48M5.477Sfalsetrue07trueActive2020-07-01T05:36:06.6410246Z2020-07-01T05:36:06.6410246Z2020-07-01T05:36:06.64Zsome-metadata-for-testing-subscriptions00000P10675199DT2H48M5SAvailablehttps://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions/sub46850f?api-version=2017-04sub46850f2020-07-01T00:25:26Z2020-07-01T00:25:26ZPT45SfalseP10675199DT2H48M5.477Sfalsetrue07trueActive2020-07-01T00:25:26.8821527Z2020-07-01T00:25:26.8821527Z2020-07-01T00:25:26.883Zsome-metadata-for-testing-subscriptions00000P10675199DT2H48M5SAvailablehttps://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions/sub679221?api-version=2017-04sub6792212020-07-01T02:09:02Z2020-07-01T02:09:02ZPT45SfalseP10675199DT2H48M5.477Sfalsetrue07trueActive2020-07-01T02:09:02.5454951Z2020-07-01T02:09:02.5454951Z2020-07-01T02:09:02.547Zsome-metadata-for-testing-subscriptions00000P10675199DT2H48M5SAvailablehttps://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions/subscription-0?api-version=2017-04subscription-02020-06-22T23:47:53Z2020-06-22T23:47:53ZPT15SfalseP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-06-22T23:47:53.9193827Z2020-06-22T23:47:53.9193827Z2020-06-22T23:47:53.92Z00000P10675199DT2H48M5.4775807SAvailablehttps://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions/subscription-1?api-version=2017-04subscription-12020-06-22T23:47:53Z2020-06-22T23:47:53ZPT15SfalseP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-06-22T23:47:53.9193827Z2020-06-22T23:47:53.9193827Z2020-06-22T23:47:53.92Z00000P10675199DT2H48M5.4775807SAvailablehttps://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions/subscription-2?api-version=2017-04subscription-22020-06-22T23:47:53Z2020-06-22T23:47:53ZPT15SfalseP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-06-22T23:47:53.9037826Z2020-06-22T23:47:53.9037826Z2020-06-22T23:47:53.903Z00000P10675199DT2H48M5.4775807SAvailablehttps://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions/subscription-3?api-version=2017-04subscription-32020-06-22T23:47:53Z2020-06-22T23:47:53ZPT15SfalseP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-06-22T23:47:53.8569185Z2020-06-22T23:47:53.8569185Z2020-06-22T23:47:53.857Z00000P10675199DT2H48M5.4775807SAvailablehttps://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions/subscription-4?api-version=2017-04subscription-42020-06-22T23:47:54Z2020-06-22T23:47:54ZPT15SfalseP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-06-22T23:47:54.0131447Z2020-06-22T23:47:54.0131447Z2020-06-22T23:47:54.013Z00000P10675199DT2H48M5.4775807SAvailablehttps://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions/subscription-5?api-version=2017-04subscription-52020-06-22T23:47:53Z2020-06-22T23:47:53ZPT15SfalseP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-06-22T23:47:53.7944244Z2020-06-22T23:47:53.7944244Z2020-06-22T23:47:53.793Z00000P10675199DT2H48M5.4775807SAvailablehttps://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions/subscription-6?api-version=2017-04subscription-62020-06-22T23:47:53Z2020-06-22T23:47:53ZPT15SfalseP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-06-22T23:47:53.9193827Z2020-06-22T23:47:53.9193827Z2020-06-22T23:47:53.92Z00000P10675199DT2H48M5.4775807SAvailablehttps://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions/subscription-7?api-version=2017-04subscription-72020-06-22T23:47:53Z2020-06-22T23:47:53ZPT15SfalseP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-06-22T23:47:53.8569185Z2020-06-22T23:47:53.8569185Z2020-06-22T23:47:53.857Z00000P10675199DT2H48M5.4775807SAvailablehttps://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions/subscription-8?api-version=2017-04subscription-82020-06-22T23:47:53Z2020-06-22T23:47:53ZPT15SfalseP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-06-22T23:47:53.8412585Z2020-06-22T23:47:53.8412585Z2020-06-22T23:47:53.84Z00000P10675199DT2H48M5.4775807SAvailablehttps://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions/subscription-9?api-version=2017-04subscription-92020-06-22T23:47:53Z2020-06-22T23:47:53ZPT15SfalseP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-06-22T23:47:53.8569185Z2020-06-22T23:47:53.8569185Z2020-06-22T23:47:53.857Z00000P10675199DT2H48M5.4775807SAvailablehttps://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions/subscription-session-0?api-version=2017-04subscription-session-02020-06-22T23:47:53Z2020-06-22T23:47:53ZPT15StrueP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-06-22T23:47:53.9819204Z2020-06-22T23:47:53.9819204Z2020-06-22T23:47:53.983Z00000P10675199DT2H48M5.4775807SAvailablehttps://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions/subscription-session-1?api-version=2017-04subscription-session-12020-06-22T23:47:54Z2020-06-22T23:47:54ZPT15StrueP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-06-22T23:47:54.0131447Z2020-06-22T23:47:54.0131447Z2020-06-22T23:47:54.013Z00000P10675199DT2H48M5.4775807SAvailablehttps://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions/subscription-session-2?api-version=2017-04subscription-session-22020-06-22T23:47:53Z2020-06-22T23:47:53ZPT15StrueP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-06-22T23:47:53.7318796Z2020-06-22T23:47:53.7318796Z2020-06-22T23:47:53.733Z00000P10675199DT2H48M5.4775807SAvailablehttps://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions/subscription-session-3?api-version=2017-04subscription-session-32020-06-22T23:47:53Z2020-06-22T23:47:53ZPT15StrueP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-06-22T23:47:53.7944244Z2020-06-22T23:47:53.7944244Z2020-06-22T23:47:53.793Z00000P10675199DT2H48M5.4775807SAvailablehttps://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions/subscription-session-4?api-version=2017-04subscription-session-42020-06-22T23:47:53Z2020-06-22T23:47:53ZPT15StrueP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-06-22T23:47:53.8100058Z2020-06-22T23:47:53.8100058Z2020-06-22T23:47:53.81Z00000P10675199DT2H48M5.4775807SAvailablehttps://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions/subscription-session-5?api-version=2017-04subscription-session-52020-06-22T23:47:53Z2020-06-22T23:47:53ZPT15StrueP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-06-22T23:47:53.9037826Z2020-06-22T23:47:53.9037826Z2020-06-22T23:47:53.903Z00000P10675199DT2H48M5.4775807SAvailablehttps://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions/subscription-session-6?api-version=2017-04subscription-session-62020-06-22T23:47:53Z2020-06-22T23:47:53ZPT15StrueP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-06-22T23:47:53.8881314Z2020-06-22T23:47:53.8881314Z2020-06-22T23:47:53.887Z00000P10675199DT2H48M5.4775807SAvailablehttps://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions/subscription-session-7?api-version=2017-04subscription-session-72020-06-22T23:47:53Z2020-06-22T23:47:53ZPT15StrueP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-06-22T23:47:53.8256302Z2020-06-22T23:47:53.8256302Z2020-06-22T23:47:53.827Z00000P10675199DT2H48M5.4775807SAvailablehttps://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions/subscription-session-8?api-version=2017-04subscription-session-82020-06-22T23:47:53Z2020-06-22T23:47:53ZPT15StrueP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-06-22T23:47:53.8412585Z2020-06-22T23:47:53.8412585Z2020-06-22T23:47:53.84Z00000P10675199DT2H48M5.4775807SAvailablehttps://sb-java-conniey-5.servicebus.windows.net/topic/subscriptions/subscription-session-9?api-version=2017-04subscription-session-92020-06-22T23:47:54Z2020-06-22T23:47:54ZPT15StrueP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-06-22T23:47:54.0131447Z2020-06-22T23:47:54.0131447Z2020-06-22T23:47:54.013Z00000P10675199DT2H48M5.4775807SAvailable", - "Date" : "Wed, 01 Jul 2020 11:40:51 GMT", + "Body" : "Subscriptionshttps://sb-java-conniey-1.servicebus.windows.net/topic-1/subscriptions?$skip=0&$top=100&api-version=2017-042020-07-02T22:49:10Zhttps://sb-java-conniey-1.servicebus.windows.net/topic-1/subscriptions/subscription?api-version=2017-04subscription2020-07-02T21:40:54Z2020-07-02T21:40:54ZPT15SfalseP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-07-02T21:40:54.3702481Z2020-07-02T21:40:54.3702481Z2020-07-02T21:40:54.3702481Z00000P10675199DT2H48M5.4775807SAvailablehttps://sb-java-conniey-1.servicebus.windows.net/topic-1/subscriptions/subscription-session?api-version=2017-04subscription-session2020-07-02T21:40:54Z2020-07-02T21:40:54ZPT15StrueP10675199DT2H48M5.4775807Sfalsetrue05trueActive2020-07-02T21:40:54.4327719Z2020-07-02T21:40:54.4327719Z2020-07-02T21:40:54.433Z00000P10675199DT2H48M5.4775807SAvailablehttps://sb-java-conniey-1.servicebus.windows.net/topic-1/subscriptions/subscription-session-1?api-version=2017-04subscription-session-12020-07-02T22:46:04Z2020-07-02T22:46:04ZPT1MfalseP10675199DT2H48M5.477Sfalsetrue010trueActive2020-07-02T22:46:04.6172301Z2020-07-02T22:46:04.6172301Z2020-07-02T22:46:04.6172301Z00000P10675199DT2H48M5.477SAvailable", + "Date" : "Thu, 02 Jul 2020 22:49:09 GMT", "Content-Type" : "application/atom+xml;type=feed;charset=utf-8" }, "Exception" : null diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/listTopics.json b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/listTopics.json index 7a92f395c386..5a354526242f 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/listTopics.json +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/session-records/listTopics.json @@ -3,18 +3,18 @@ "Method" : "GET", "Uri" : "https://REDACTED.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-04", "Headers" : { - "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10 10.0)" + "User-Agent" : "azsdk-java-azure-messaging-servicebus/7.0.0-beta.4 (11.0.5; Windows 10; 10.0)" }, "Response" : { "Transfer-Encoding" : "chunked", "Server" : "Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "Body" : "Topicshttps://sb-java-conniey-5.servicebus.windows.net/$Resources/topics?$skip=0&$top=10&api-version=2017-042020-07-01T11:20:41Zhttps://sb-java-conniey-5.servicebus.windows.net/test23290?api-version=2017-04test232902020-07-01T08:35:41Z2020-07-01T08:35:41Zsb-java-conniey-5test23290P10675199DT2H48M5.477S2048truePT2Mtrue0falsefalseActive2020-07-01T08:35:41.32Z2020-07-01T08:35:41.367Z0001-01-01T00:00:00Zfalse000000P10675199DT2H48M5.477Sfalsesome-metadata-for-testing-topicAvailablefalsefalsehttps://sb-java-conniey-5.servicebus.windows.net/topic?api-version=2017-04topic2020-06-22T23:47:51Z2020-06-22T23:47:51Zsb-java-conniey-5P10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2020-06-22T23:47:51.543Z2020-06-22T23:47:51.627Z2020-07-01T05:36:06.6410246Ztrue0000023P10675199DT2H48M5.4775807SfalseAvailablefalsefalsehttps://sb-java-conniey-5.servicebus.windows.net/topic97369?api-version=2017-04topic973692020-07-01T08:24:27Z2020-07-01T08:24:27Zsb-java-conniey-5topic97369P10675199DT2H48M5.477S1024falsePT1Mtrue0falsefalseActive2020-07-01T08:24:27.193Z2020-07-01T08:24:27.333Z2020-07-01T08:24:28.1087177Zfalse000000P10675199DT2H48M5.477SfalseAvailablefalsefalse", - "Date" : "Wed, 01 Jul 2020 11:20:40 GMT", + "Body" : "Topicshttps://sb-java-conniey-1.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-042020-07-02T22:49:13Zhttps://sb-java-conniey-1.servicebus.windows.net/test00419?api-version=2017-04test004192020-07-02T22:46:54Z2020-07-02T22:46:54Zsb-java-conniey-1test00419P10675199DT2H48M5.477S2048truePT2Mtrue0falsefalseActive2020-07-02T22:46:54.6745275Z2020-07-02T22:46:54.6745275Z0001-01-01T00:00:00Zfalse000000P10675199DT2H48M5.477Sfalsesome-metadata-for-testing-topicAvailablefalsefalsehttps://sb-java-conniey-1.servicebus.windows.net/test27109?api-version=2017-04test271092020-07-02T22:46:08Z2020-07-02T22:46:08Zsb-java-conniey-1test27109P10675199DT2H48M5.477S2048truePT2Mtrue0falsefalseActive2020-07-02T22:46:08.047438Z2020-07-02T22:46:08.047438Z0001-01-01T00:00:00Zfalse000000P10675199DT2H48M5.477Sfalsesome-metadata-for-testing-topicAvailablefalsefalsehttps://sb-java-conniey-1.servicebus.windows.net/test50863?api-version=2017-04test508632020-07-02T22:49:12Z2020-07-02T22:49:12Zsb-java-conniey-1test50863P10675199DT2H48M5.477S2048truePT2Mtrue0falsefalseActive2020-07-02T22:49:12.47Z2020-07-02T22:49:12.56Z0001-01-01T00:00:00Zfalse000000P10675199DT2H48M5.477Sfalsesome-metadata-for-testing-topicAvailablefalsefalsehttps://sb-java-conniey-1.servicebus.windows.net/test53188?api-version=2017-04test531882020-07-02T21:56:16Z2020-07-02T21:56:17Zsb-java-conniey-1test53188P10675199DT2H48M5.477S2048truePT2Mtrue0falsefalseActive2020-07-02T21:56:16.8983363Z2020-07-02T21:56:16.8983363Z0001-01-01T00:00:00Zfalse000000P10675199DT2H48M5.477Sfalsesome-metadata-for-testing-topicAvailablefalsefalsehttps://sb-java-conniey-1.servicebus.windows.net/test99509?api-version=2017-04test995092020-07-02T22:40:21Z2020-07-02T22:40:21Zsb-java-conniey-1test99509P10675199DT2H48M5.477S2048truePT2Mtrue0falsefalseActive2020-07-02T22:40:21.8989155Z2020-07-02T22:40:21.8989155Z0001-01-01T00:00:00Zfalse000000P10675199DT2H48M5.477Sfalsesome-metadata-for-testing-topicAvailablefalsefalsehttps://sb-java-conniey-1.servicebus.windows.net/topic-0?api-version=2017-04topic-02020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1P10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2020-07-02T21:40:52.4620569Z2020-07-02T21:40:52.4620569Z2020-07-02T22:49:02.122152Ztrue000005P10675199DT2H48M5.4775807SfalseAvailablefalsefalsehttps://sb-java-conniey-1.servicebus.windows.net/topic-1?api-version=2017-04topic-12020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1P10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2020-07-02T21:40:52.3077409Z2020-07-02T21:40:52.3077409Z2020-07-02T22:46:04.6172301Ztrue000003P10675199DT2H48M5.4775807SfalseAvailablefalsefalsehttps://sb-java-conniey-1.servicebus.windows.net/topic-10?api-version=2017-04topic-102020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1P10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2020-07-02T21:40:52.42Z2020-07-02T21:40:52.64Z2020-07-02T21:40:54.8940272Ztrue000002P10675199DT2H48M5.4775807SfalseAvailablefalsefalsehttps://sb-java-conniey-1.servicebus.windows.net/topic-11?api-version=2017-04topic-112020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1P10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2020-07-02T21:40:52.17Z2020-07-02T21:40:52.277Z2020-07-02T21:40:54.3011986Ztrue000002P10675199DT2H48M5.4775807SfalseAvailablefalsefalsehttps://sb-java-conniey-1.servicebus.windows.net/topic-12?api-version=2017-04topic-122020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1P10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2020-07-02T21:40:52.2589036Z2020-07-02T21:40:52.2589036Z2020-07-02T21:40:54.267Ztrue000002P10675199DT2H48M5.4775807SfalseAvailablefalsefalsehttps://sb-java-conniey-1.servicebus.windows.net/topic-13?api-version=2017-04topic-132020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1P10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2020-07-02T21:40:52.4776547Z2020-07-02T21:40:52.4776547Z2020-07-02T21:40:54.643Ztrue000002P10675199DT2H48M5.4775807SfalseAvailablefalsefalsehttps://sb-java-conniey-1.servicebus.windows.net/topic-14?api-version=2017-04topic-142020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1P10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2020-07-02T21:40:52.17Z2020-07-02T21:40:52.31Z2020-07-02T21:40:54.3636972Ztrue000002P10675199DT2H48M5.4775807SfalseAvailablefalsefalsehttps://sb-java-conniey-1.servicebus.windows.net/topic-2?api-version=2017-04topic-22020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1P10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2020-07-02T21:40:52.29Z2020-07-02T21:40:52.43Z2020-07-02T21:40:54.8995889Ztrue000002P10675199DT2H48M5.4775807SfalseAvailablefalsefalsehttps://sb-java-conniey-1.servicebus.windows.net/topic-3?api-version=2017-04topic-32020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1P10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2020-07-02T21:40:52.35Z2020-07-02T21:40:52.47Z2020-07-02T21:40:54.5649646Ztrue000002P10675199DT2H48M5.4775807SfalseAvailablefalsefalsehttps://sb-java-conniey-1.servicebus.windows.net/topic-4?api-version=2017-04topic-42020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1P10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2020-07-02T21:40:52.4667131Z2020-07-02T21:40:52.4667131Z2020-07-02T21:40:54.6176619Ztrue000002P10675199DT2H48M5.4775807SfalseAvailablefalsefalsehttps://sb-java-conniey-1.servicebus.windows.net/topic-5?api-version=2017-04topic-52020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1P10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2020-07-02T21:40:52.3630895Z2020-07-02T21:40:52.3630895Z2020-07-02T21:40:54.6139342Ztrue000002P10675199DT2H48M5.4775807SfalseAvailablefalsefalsehttps://sb-java-conniey-1.servicebus.windows.net/topic-6?api-version=2017-04topic-62020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1P10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2020-07-02T21:40:52.352692Z2020-07-02T21:40:52.352692Z2020-07-02T21:40:54.377Ztrue000002P10675199DT2H48M5.4775807SfalseAvailablefalsefalsehttps://sb-java-conniey-1.servicebus.windows.net/topic-7?api-version=2017-04topic-72020-07-02T21:40:52Z2020-07-02T21:40:52Zsb-java-conniey-1P10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2020-07-02T21:40:52.3474803Z2020-07-02T21:40:52.3474803Z2020-07-02T21:40:54.427Ztrue000002P10675199DT2H48M5.4775807SfalseAvailablefalsefalsehttps://sb-java-conniey-1.servicebus.windows.net/topic-8?api-version=2017-04topic-82020-07-02T21:41:08Z2020-07-02T21:41:08Zsb-java-conniey-1P10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2020-07-02T21:41:08.1381576Z2020-07-02T21:41:08.1381576Z2020-07-02T21:41:10.2170259Ztrue000002P10675199DT2H48M5.4775807SfalseAvailablefalsefalsehttps://sb-java-conniey-1.servicebus.windows.net/topic-9?api-version=2017-04topic-92020-07-02T21:40:53Z2020-07-02T21:40:53Zsb-java-conniey-1P10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2020-07-02T21:40:53.4201079Z2020-07-02T21:40:53.4201079Z2020-07-02T21:40:55.7102711Ztrue000002P10675199DT2H48M5.4775807SfalseAvailablefalsefalsehttps://sb-java-conniey-1.servicebus.windows.net/topic08886?api-version=2017-04topic088862020-07-02T22:49:06Z2020-07-02T22:49:06Zsb-java-conniey-1topic08886P10675199DT2H48M5.477S1024falsePT1Mtrue0falsefalseActive2020-07-02T22:49:06.8664428Z2020-07-02T22:49:06.8664428Z2020-07-02T22:49:07.5070756Zfalse000000P10675199DT2H48M5.477SfalseAvailablefalsefalsehttps://sb-java-conniey-1.servicebus.windows.net/topic11570?api-version=2017-04topic115702020-07-02T22:46:47Z2020-07-02T22:46:48Zsb-java-conniey-1topic11570P10675199DT2H48M5.477S1024falsePT1Mtrue0falsefalseActive2020-07-02T22:46:47.9908245Z2020-07-02T22:46:47.9908245Z2020-07-02T22:46:48.7148151Zfalse000000P10675199DT2H48M5.477SfalseAvailablefalsefalsehttps://sb-java-conniey-1.servicebus.windows.net/topic11588?api-version=2017-04topic115882020-07-02T22:40:09Z2020-07-02T22:40:10Zsb-java-conniey-1topic11588P10675199DT2H48M5.477S1024falsePT1Mtrue0falsefalseActive2020-07-02T22:40:09.4817544Z2020-07-02T22:40:09.4817544Z2020-07-02T22:40:11.0442653Zfalse000000P10675199DT2H48M5.477SfalseAvailablefalsefalsehttps://sb-java-conniey-1.servicebus.windows.net/topic35988?api-version=2017-04topic359882020-07-02T21:56:07Z2020-07-02T21:56:07Zsb-java-conniey-1topic35988P10675199DT2H48M5.477S1024falsePT1Mtrue0falsefalseActive2020-07-02T21:56:07.3307015Z2020-07-02T21:56:07.3307015Z2020-07-02T21:56:08.2994586Zfalse000000P10675199DT2H48M5.477SfalseAvailablefalsefalsehttps://sb-java-conniey-1.servicebus.windows.net/topic54477?api-version=2017-04topic544772020-07-02T22:46:01Z2020-07-02T22:46:01Zsb-java-conniey-1topic54477P10675199DT2H48M5.477S1024falsePT1Mtrue0falsefalseActive2020-07-02T22:46:01.6845378Z2020-07-02T22:46:01.6845378Z2020-07-02T22:46:02.5449437Zfalse000000P10675199DT2H48M5.477SfalseAvailablefalsefalse", + "Date" : "Thu, 02 Jul 2020 22:49:12 GMT", "Content-Type" : "application/atom+xml;type=feed;charset=utf-8" }, "Exception" : null } ], "variables" : [ ] -} +} \ No newline at end of file diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/resources/xml/NamespaceEntry.xml b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/xml/NamespaceEntry.xml new file mode 100644 index 000000000000..bffee2575895 --- /dev/null +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/resources/xml/NamespaceEntry.xml @@ -0,0 +1,21 @@ + + https://shivangiservicebus.servicebus.windows.net/$namespaceinfo?api-version=2017-04 + ShivangiServiceBus + 2020-07-02T09:53:19Z + + ShivangiServiceBus + + + + + MyServiceBusFallback + 2020-04-09T08:38:55.807Z + Premium + 1 + 2020-06-12T06:34:38.383Z + ShivangiServiceBus + Messaging + + + diff --git a/sdk/spring/CONTRIBUTING.md b/sdk/spring/CONTRIBUTING.md new file mode 100644 index 000000000000..87b09e0025e9 --- /dev/null +++ b/sdk/spring/CONTRIBUTING.md @@ -0,0 +1,74 @@ +# Contributing + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License +Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For +details, visit https://cla.microsoft.com. + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate +the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to +do this once across all repositories using our CLA. + +## Code of conduct + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact +[opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. + +## Getting started + +Before working on a contribution, it would be beneficial to familiarize yourself with the project so that your +submission is consistent with the project standards and is ready to be accepted with fewer changes requested. + +- [Azure Spring Boot README](./README.md), to learn more about the overall project and processes used. + +## Development environment setup + +### Prerequisites + +- Java Development Kit (JDK) with version 8 or above +- [Maven][maven] +- Git +- Microsoft Azure subscription + - You can create a free account at: https://azure.microsoft.com + +## Building from source + +To build the project, open a command prompt/terminal: +1. Execute `git clone https://github.com/Azure/azure-sdk-for-java.git` +1. Traverse to the spring directory: + * `cd sdk\spring` +1. Build the product by executing: + * `mvn clean package -DskipTests` + +## Running tests + +After following instructions above, you can run the +unit tests by executing: +```shell +mvn clean test +``` + +For unit tests, there are no special considerations; these are self-contained and execute locally without any reliance +on external resources. These tests are run for all PR validations. + + +## FAQ + +When building Spring Boot project, if it fails on the sample `azure-spring-boot-sample-servicebus`, please deploy the +`com.azure:azure-messaging-servicebus` to your local repository manually by: +```shell +cd sdk\servicebus\azure-messaging-service +mvn clean install -DskipTests +``` +This is because the version of `com.azure:azure-messaging-servicebus` library the sample depends on is from this SDK +repository instead of Maven. + +## Version management +Developing version naming convention is like `0.1.2-beta.1`. Release version naming convention is like `0.1.2`. + +## Contribute to code +Contribution is welcome. Please follow +[this instruction](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md) to contribute code. + + +[maven]: https://maven.apache.org/ diff --git a/sdk/spring/README.md b/sdk/spring/README.md index 3c908180e664..3948797d4a82 100644 --- a/sdk/spring/README.md +++ b/sdk/spring/README.md @@ -59,7 +59,7 @@ You could check below articles to learn more on usage of specific starters. ## Contributing This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com. -Please follow [instructions here](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md) to build from source or contribute. +Please follow [instructions here](./CONTRIBUTING.md) to build from source or contribute. ### Filing Issues diff --git a/sdk/spring/azure-spring-boot-samples/azure-cloud-foundry-service-sample/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-cloud-foundry-service-sample/pom.xml index 6e2c7a1dae7e..6bf68ed712aa 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-cloud-foundry-service-sample/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-cloud-foundry-service-sample/pom.xml @@ -4,13 +4,14 @@ 4.0.0 - com.microsoft.azure - azure-spring-boot-samples - 1.0.0 - ../pom.xml + org.springframework.boot + spring-boot-starter-parent + 2.3.0.RELEASE + com.azure azure-cloud-foundry-service-sample + 1.0.0 jar Azure Cloud Foundry Service Sample diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-b2c-oidc/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-b2c-oidc/pom.xml index ec15c4c34ddc..b3773beca50a 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-b2c-oidc/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-b2c-oidc/pom.xml @@ -4,16 +4,17 @@ 4.0.0 - com.microsoft.azure - azure-spring-boot-samples - 1.0.0 - ../pom.xml + org.springframework.boot + spring-boot-starter-parent + 2.3.0.RELEASE + com.azure azure-spring-boot-sample-active-directory-b2c-oidc + 1.0.0 jar - Azure AD B2C Spring Security 5 OAuth2 Integration Spring Boot Sample + Azure Spring Boot Starter Sample - Azure AD B2C Spring Security 5 OAuth Integration Azure AD B2C Spring Security 5 OAuth2 Integration Spring Boot Sample https://github.com/Azure/azure-sdk-for-java diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-backend-v2/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-backend-v2/pom.xml index cbd0d92c837d..ebb1c722b568 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-backend-v2/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-backend-v2/pom.xml @@ -1,54 +1,55 @@ - 4.0.0 + 4.0.0 - - com.microsoft.azure - azure-spring-boot-samples - 1.0.0 - ../pom.xml - + + org.springframework.boot + spring-boot-starter-parent + 2.3.0.RELEASE + - azure-spring-boot-sample-active-directory-backend-v2 - jar + com.azure + azure-spring-boot-sample-active-directory-backend-v2 + 1.0.0 + jar - Azure AD Spring Security 5 OAuth2 V2 Integration Spring Boot Sample - Azure AD Spring Security 5 OAuth2 V2 Integration Spring Boot Sample - https://github.com/Azure/azure-sdk-for-java + Azure Spring Boot Starter Sample - Azure AD Spring Security Integration v2 + Azure AD Spring Security 5 OAuth2 V2 Integration Spring Boot Sample + https://github.com/Azure/azure-sdk-for-java - - - com.microsoft.azure - azure-active-directory-spring-boot-starter - 2.3.3-beta.1 - + + + com.microsoft.azure + azure-active-directory-spring-boot-starter + 2.3.3-beta.1 + - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-thymeleaf - + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-thymeleaf + - - org.springframework.boot - spring-boot-starter-security - - - org.springframework.security - spring-security-oauth2-client - - - org.springframework.security - spring-security-oauth2-jose - - - org.thymeleaf.extras - thymeleaf-extras-springsecurity5 - - + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.security + spring-security-oauth2-client + + + org.springframework.security + spring-security-oauth2-jose + + + org.thymeleaf.extras + thymeleaf-extras-springsecurity5 + + diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-backend/README.md b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-backend/README.md index aa6fecd9d496..cf791d11705d 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-backend/README.md +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-backend/README.md @@ -26,6 +26,9 @@ azure.activedirectory.tenant-id=xxxxxx-your-tenant-id-xxxxxx azure.activedirectory.active-directory-groups=group1, group2 ``` +If `azure.activedirectory.tenant-id` is configured, `AADOAuth2LoginSecurityConfig` will take effect and this app will use AAD to authentication and authorization. +If `azure.activedirectory.tenant-id` is **NOT** configured, `NoLoginSecurityConfig` will take effect and this app will **NOT** use AAD to authentication and authorization. + ### Run with Maven ```shell # Under sdk/spring project root directory diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-backend/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-backend/pom.xml index 292780bbe355..408b7867beb2 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-backend/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-backend/pom.xml @@ -1,54 +1,55 @@ - 4.0.0 + 4.0.0 - - com.microsoft.azure - azure-spring-boot-samples - 1.0.0 - ../pom.xml - + + org.springframework.boot + spring-boot-starter-parent + 2.3.0.RELEASE + - azure-spring-boot-sample-active-directory-backend - jar + com.azure + azure-spring-boot-sample-active-directory-backend + 1.0.0 + jar - Azure AD Spring Security 5 OAuth2 Integration Spring Boot Sample - Azure AD Spring Security 5 OAuth2 Integration Spring Boot Sample - https://github.com/Azure/azure-sdk-for-java + Azure Spring Boot Starter Sample - Azure AD Spring Security Integration + Azure AD Spring Security 5 OAuth2 Integration Spring Boot Sample + https://github.com/Azure/azure-sdk-for-java - - - com.microsoft.azure - azure-active-directory-spring-boot-starter - 2.3.3-beta.1 - + + + com.microsoft.azure + azure-active-directory-spring-boot-starter + 2.3.3-beta.1 + - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-thymeleaf - + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-thymeleaf + - - org.springframework.boot - spring-boot-starter-security - - - org.springframework.security - spring-security-oauth2-client - - - org.springframework.security - spring-security-oauth2-jose - - - org.thymeleaf.extras - thymeleaf-extras-springsecurity5 - - + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.security + spring-security-oauth2-client + + + org.springframework.security + spring-security-oauth2-jose + + + org.thymeleaf.extras + thymeleaf-extras-springsecurity5 + + diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-backend/src/main/java/com/microsoft/azure/aad/controller/HomeController.java b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-backend/src/main/java/com/microsoft/azure/aad/controller/HomeController.java index 6a0e802ea30a..c0ac526c1cf6 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-backend/src/main/java/com/microsoft/azure/aad/controller/HomeController.java +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-backend/src/main/java/com/microsoft/azure/aad/controller/HomeController.java @@ -4,6 +4,7 @@ package com.microsoft.azure.aad.controller; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.oauth2.client.OAuth2AuthorizedClient; import org.springframework.security.oauth2.client.OAuth2AuthorizedClientService; @@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ResponseBody; +@ConditionalOnProperty(prefix = "azure.activedirectory", value = "tenant-id") @Controller public class HomeController { @Autowired diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-backend/src/main/java/com/microsoft/azure/aad/security/AADOAuth2LoginSecurityConfig.java b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-backend/src/main/java/com/microsoft/azure/aad/security/AADOAuth2LoginSecurityConfig.java index b07f305f3d45..dee2f0268b37 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-backend/src/main/java/com/microsoft/azure/aad/security/AADOAuth2LoginSecurityConfig.java +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-backend/src/main/java/com/microsoft/azure/aad/security/AADOAuth2LoginSecurityConfig.java @@ -4,6 +4,7 @@ package com.microsoft.azure.aad.security; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; @@ -12,6 +13,7 @@ import org.springframework.security.oauth2.client.userinfo.OAuth2UserService; import org.springframework.security.oauth2.core.oidc.user.OidcUser; +@ConditionalOnProperty(prefix = "azure.activedirectory", value = "tenant-id") @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) public class AADOAuth2LoginSecurityConfig extends WebSecurityConfigurerAdapter { diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-backend/src/main/java/com/microsoft/azure/aad/security/NoLoginSecurityConfig.java b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-backend/src/main/java/com/microsoft/azure/aad/security/NoLoginSecurityConfig.java new file mode 100644 index 000000000000..7880d4c43c68 --- /dev/null +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-backend/src/main/java/com/microsoft/azure/aad/security/NoLoginSecurityConfig.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.aad.security; + +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; + +// If "azure.activedirectory.tenant-id" is not configured, +// this bean will take effect to disable login. +@ConditionalOnMissingBean(AADOAuth2LoginSecurityConfig.class) +@EnableWebSecurity +@EnableGlobalMethodSecurity(prePostEnabled = true) +public class NoLoginSecurityConfig extends WebSecurityConfigurerAdapter { + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.authorizeRequests() + .antMatchers("/**") + .permitAll(); + } +} diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-stateless/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-stateless/pom.xml index 1a82a9d4b10d..22a4296737c9 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-stateless/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-stateless/pom.xml @@ -1,49 +1,49 @@ - 4.0.0 - - - com.microsoft.azure - azure-spring-boot-samples - 1.0.0 - ../pom.xml - - - - azure-spring-boot-sample-active-directory-stateless - - Azure AD Stateless Spring Security Integration Spring Boot Sample - Sample project using the AAD stateless app-role filter for AAD integration in Spring Security - https://github.com/Azure/azure-sdk-for-java - - - - com.microsoft.azure - azure-active-directory-spring-boot-starter - 2.3.3-beta.1 - - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-security - - - - org.springframework.security - spring-security-oauth2-client - - - - org.springframework.security - spring-security-oauth2-jose - - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + 2.3.0.RELEASE + + + com.azure + azure-spring-boot-sample-active-directory-stateless + 1.0.0 + + Azure Spring Boot Starter Sample - Azure AD Stateless Spring Security Integration + Sample project using the AAD stateless app-role filter for AAD integration in Spring Security + https://github.com/Azure/azure-sdk-for-java + + + + com.microsoft.azure + azure-active-directory-spring-boot-starter + 2.3.3-beta.1 + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-security + + + + org.springframework.security + spring-security-oauth2-client + + + + org.springframework.security + spring-security-oauth2-jose + + diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory/pom.xml index 042fec4e4c15..4e49e9dfcd79 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory/pom.xml @@ -4,16 +4,17 @@ 4.0.0 - com.microsoft.azure - azure-spring-boot-samples - 1.0.0 - ../pom.xml + org.springframework.boot + spring-boot-starter-parent + 2.3.0.RELEASE + com.azure azure-spring-boot-sample-active-directory + 1.0.0 jar - Azure AD Spring Security Integration Spring Boot Sample + Azure Spring Boot Starter Sample - Azure AD Spring Security Integration Azure AD Spring Security Integration Spring Boot Sample https://github.com/Azure/azure-sdk-for-java diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-cosmosdb/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-cosmosdb/pom.xml index e9b6195ab0ae..fe8405d77d90 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-cosmosdb/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-cosmosdb/pom.xml @@ -4,16 +4,17 @@ 4.0.0 - com.microsoft.azure - azure-spring-boot-samples - 1.0.0 - ../pom.xml + org.springframework.boot + spring-boot-starter-parent + 2.3.0.RELEASE + com.azure azure-spring-boot-sample-cosmosdb + 1.0.0 jar - Azure Cosmos DB Spring Boot Starter Sample + Azure Spring Boot Starter Sample - Cosmos DB Sample project for Azure Document DB Starter https://github.com/Azure/azure-sdk-for-java diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-data-gremlin/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-data-gremlin/pom.xml index fdf7507fa6e9..82ab68f45fd5 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-data-gremlin/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-data-gremlin/pom.xml @@ -5,16 +5,17 @@ 4.0.0 - com.microsoft.azure - azure-spring-boot-samples - 1.0.0 - ../pom.xml + org.springframework.boot + spring-boot-starter-parent + 2.3.0.RELEASE + com.azure azure-spring-boot-sample-data-gremlin + 1.0.0 jar - Spring Data Gremlin Boot Starter Sample + Azure Spring Boot Starter Sample - Spring Data Gremlin Sample project for Spring Data Gremlin https://github.com/Azure/azure-sdk-for-java diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-keyvault-secrets/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-keyvault-secrets/pom.xml index a07a10824903..3123c4636f23 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-keyvault-secrets/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-keyvault-secrets/pom.xml @@ -5,16 +5,17 @@ 4.0.0 - com.microsoft.azure - azure-spring-boot-samples - 1.0.0 - ../pom.xml + org.springframework.boot + spring-boot-starter-parent + 2.3.0.RELEASE + com.azure azure-spring-boot-sample-keyvault-secrets + 1.0.0 jar - Azure Key Vault Secrets Spring Boot Starter Sample + Azure Spring Boot Starter Sample - Key Vault Secrets Sample project for Azure Key Vault Secrets Starter https://github.com/Azure/azure-sdk-for-java diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-mediaservices/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-mediaservices/pom.xml index 42635de23369..48c552e78504 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-mediaservices/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-mediaservices/pom.xml @@ -5,16 +5,17 @@ 4.0.0 - com.microsoft.azure - azure-spring-boot-samples - 1.0.0 - ../pom.xml + org.springframework.boot + spring-boot-starter-parent + 2.3.0.RELEASE + com.azure azure-spring-boot-sample-mediaservices + 1.0.0 jar - Azure Media Services Spring Boot Sample + Azure Spring Boot Starter Sample - Media Services Sample project for Azure Media Services https://github.com/Azure/azure-sdk-for-java diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-queue/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-queue/pom.xml index b6854172191e..82d3a20f5053 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-queue/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-queue/pom.xml @@ -5,16 +5,17 @@ 4.0.0 - com.microsoft.azure - azure-spring-boot-samples - 1.0.0 - ../pom.xml + org.springframework.boot + spring-boot-starter-parent + 2.3.0.RELEASE + com.azure azure-spring-boot-sample-servicebus-jms-queue + 1.0.0 jar - Azure Service Bus JMS Queue Spring Boot Starter Sample + Azure Spring Boot Starter Sample - Service Bus JMS Queue Sample project for Spring Boot Service Bus JMS Starter https://github.com/Azure/azure-sdk-for-java diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-topic/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-topic/pom.xml index ea0698400c45..ee5c4289fe4a 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-topic/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-topic/pom.xml @@ -5,16 +5,17 @@ 4.0.0 - com.microsoft.azure - azure-spring-boot-samples - 1.0.0 - ../pom.xml + org.springframework.boot + spring-boot-starter-parent + 2.3.0.RELEASE + com.azure azure-spring-boot-sample-servicebus-jms-topic + 1.0.0 jar - Azure Service Bus JMS Topic Spring Boot Starter Sample + Azure Spring Boot Starter Sample - Service Bus JMS Topic Sample project for Spring Boot Service Bus JMS Starter https://github.com/Azure/azure-sdk-for-java diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus/pom.xml index 09d6653d555e..76529026d881 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus/pom.xml @@ -5,16 +5,17 @@ 4.0.0 - com.microsoft.azure - azure-spring-boot-samples - 1.0.0 - ../pom.xml + org.springframework.boot + spring-boot-starter-parent + 2.3.0.RELEASE + com.azure azure-spring-boot-sample-servicebus + 1.0.0 jar - Azure Service Bus Spring Boot Starter Sample + Azure Spring Boot Starter Sample - Service Bus Sample project for Spring Boot Service Bus Starter https://github.com/Azure/azure-sdk-for-java diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-storage-blob/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-storage-blob/pom.xml index f8f4145b82f8..da8a272d062d 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-storage-blob/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-storage-blob/pom.xml @@ -5,16 +5,17 @@ 4.0.0 - com.microsoft.azure - azure-spring-boot-samples - 1.0.0 - ../pom.xml + org.springframework.boot + spring-boot-starter-parent + 2.3.0.RELEASE + com.azure azure-spring-boot-sample-storage-blob + 1.0.0 jar - Azure Storage Spring Boot Starter Sample + Azure Spring Boot Starter Sample - Storage Blob Sample project for Azure Storage Starter https://github.com/Azure/azure-sdk-for-java @@ -30,7 +31,7 @@ com.azure azure-storage-blob - 12.7.0 + 12.8.0-beta.1 diff --git a/sdk/spring/azure-spring-boot-samples/pom.xml b/sdk/spring/azure-spring-boot-samples/pom.xml deleted file mode 100644 index 5f201b3fa860..000000000000 --- a/sdk/spring/azure-spring-boot-samples/pom.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - 4.0.0 - - - org.springframework.boot - spring-boot-starter-parent - 2.3.0.RELEASE - - - - com.microsoft.azure - azure-spring-boot-samples - pom - 1.0.0 - - Azure Spring Boot Samples - Samples for Azure Spring Boot - https://github.com/Azure/azure-sdk-for-java - - - - The MIT License (MIT) - http://opensource.org/licenses/MIT - repo - - - - - - microsoft - Microsoft Corporation - - - - - scm:git:git://github.com/azure/azure-sdk-for-java - scm:git:git://github.com/azure/azure-sdk-for-java - https://github.com/azure/azure-sdk-for-java - - - - GitHub - https://github.com/azure/azure-sdk-for-java/issues - - - - 1.8 - UTF-8 - UTF-8 - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - azure-spring-boot-sample-active-directory - azure-spring-boot-sample-active-directory-b2c-oidc - azure-spring-boot-sample-active-directory-backend - azure-spring-boot-sample-active-directory-backend-v2 - azure-spring-boot-sample-active-directory-stateless - azure-spring-boot-sample-cosmosdb - azure-spring-boot-sample-data-gremlin - azure-spring-boot-sample-keyvault-secrets - azure-spring-boot-sample-mediaservices - azure-spring-boot-sample-servicebus - azure-spring-boot-sample-servicebus-jms-queue - azure-spring-boot-sample-servicebus-jms-topic - azure-spring-boot-sample-storage-blob - azure-cloud-foundry-service-sample - - - diff --git a/sdk/spring/azure-spring-boot-starter-active-directory/README.md b/sdk/spring/azure-spring-boot-starter-active-directory/README.md index 9644843b0f1e..02edeb4e9d5e 100644 --- a/sdk/spring/azure-spring-boot-starter-active-directory/README.md +++ b/sdk/spring/azure-spring-boot-starter-active-directory/README.md @@ -28,7 +28,7 @@ If you are using Maven, add the following dependency. [//]: # "{x-version-update-start;com.azure:azure-active-directory-spring-boot-starter;current}" ```xml - com.azure + com.microsoft.azure azure-active-directory-spring-boot-starter 2.3.3-beta.1 diff --git a/sdk/spring/azure-spring-boot-starter-cosmosdb/README.md b/sdk/spring/azure-spring-boot-starter-cosmosdb/README.md index c9d20f8580b9..49a0ee643bf3 100644 --- a/sdk/spring/azure-spring-boot-starter-cosmosdb/README.md +++ b/sdk/spring/azure-spring-boot-starter-cosmosdb/README.md @@ -209,6 +209,6 @@ Find more information about Azure Service Privacy Statement, please check [Micro ## Next steps -Besides using this Azure CosmosDb Spring Boot Starter, you can directly use Spring Data for Azure CosmosDb package for more complex scenarios. Please refer to [Spring Data for Azure CosmosDB](https://github.com/Microsoft/spring-data-cosmosdb) for more details. +Besides using this Azure CosmosDb Spring Boot Starter, you can directly use Spring Data for Azure CosmosDb package for more complex scenarios. Please refer to [Spring Data for Azure CosmosDB](https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/cosmos/azure-spring-data-cosmos) for more details. ## Contributing diff --git a/sdk/spring/azure-spring-boot-starter-servicebus-jms/pom.xml b/sdk/spring/azure-spring-boot-starter-servicebus-jms/pom.xml index f84449b7dc7e..984c7399811e 100644 --- a/sdk/spring/azure-spring-boot-starter-servicebus-jms/pom.xml +++ b/sdk/spring/azure-spring-boot-starter-servicebus-jms/pom.xml @@ -26,6 +26,11 @@ 2.3.3-beta.1 + + org.springframework.boot + spring-boot-starter-validation + 2.3.0.RELEASE + org.springframework @@ -53,6 +58,7 @@ com.microsoft.azure:azure-servicebus-jms:[0.0.2] com.microsoft.azure:azure-spring-boot:[2.3.3-beta.1] org.springframework:spring-jms:[5.2.6.RELEASE] + org.springframework.boot:spring-boot-starter-validation:[2.3.0.RELEASE] diff --git a/sdk/spring/azure-spring-boot-test-aad/README.md b/sdk/spring/azure-spring-boot-test-aad/README.md new file mode 100644 index 000000000000..a20e9ce11abe --- /dev/null +++ b/sdk/spring/azure-spring-boot-test-aad/README.md @@ -0,0 +1,9 @@ +# Azure Spring Boot Integration tests client library for Java + +## Key concepts +## Getting started +## Key concepts +## Examples +## Troubleshooting +## Next steps +## Contributing diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-aad/pom.xml b/sdk/spring/azure-spring-boot-test-aad/pom.xml similarity index 77% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-aad/pom.xml rename to sdk/spring/azure-spring-boot-test-aad/pom.xml index 4685339f2b04..f263520b730b 100644 --- a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-aad/pom.xml +++ b/sdk/spring/azure-spring-boot-test-aad/pom.xml @@ -3,20 +3,22 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - azure-spring-boot-tests - com.microsoft.azure - 2.3.3-beta.1 - ../pom.xml + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent 4.0.0 + com.azure azure-spring-boot-test-aad + 1.0.0 - com.microsoft.azure + com.azure azure-spring-boot-test-core - 2.3.3-beta.1 + 1.0.0 com.microsoft.azure @@ -31,6 +33,10 @@ + + true + + @@ -41,6 +47,7 @@ + com.azure:* com.microsoft.azure:* org.springframework.boot:spring-boot-starter-web:[2.3.0.RELEASE] diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-aad/src/test/java/com/microsoft/azure/test/aad/approle/AADAppRoleStatelessAuthenticationFilterIT.java b/sdk/spring/azure-spring-boot-test-aad/src/test/java/com/microsoft/azure/test/aad/approle/AADAppRoleStatelessAuthenticationFilterIT.java similarity index 100% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-aad/src/test/java/com/microsoft/azure/test/aad/approle/AADAppRoleStatelessAuthenticationFilterIT.java rename to sdk/spring/azure-spring-boot-test-aad/src/test/java/com/microsoft/azure/test/aad/approle/AADAppRoleStatelessAuthenticationFilterIT.java diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-aad/src/test/java/com/microsoft/azure/test/aad/group/AADAuthenticationFilterIT.java b/sdk/spring/azure-spring-boot-test-aad/src/test/java/com/microsoft/azure/test/aad/group/AADAuthenticationFilterIT.java similarity index 100% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-aad/src/test/java/com/microsoft/azure/test/aad/group/AADAuthenticationFilterIT.java rename to sdk/spring/azure-spring-boot-test-aad/src/test/java/com/microsoft/azure/test/aad/group/AADAuthenticationFilterIT.java diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-aad/src/test/java/com/microsoft/azure/test/oauth/OAuthResponse.java b/sdk/spring/azure-spring-boot-test-aad/src/test/java/com/microsoft/azure/test/oauth/OAuthResponse.java similarity index 100% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-aad/src/test/java/com/microsoft/azure/test/oauth/OAuthResponse.java rename to sdk/spring/azure-spring-boot-test-aad/src/test/java/com/microsoft/azure/test/oauth/OAuthResponse.java diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-aad/src/test/java/com/microsoft/azure/test/oauth/OAuthUtils.java b/sdk/spring/azure-spring-boot-test-aad/src/test/java/com/microsoft/azure/test/oauth/OAuthUtils.java similarity index 100% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-aad/src/test/java/com/microsoft/azure/test/oauth/OAuthUtils.java rename to sdk/spring/azure-spring-boot-test-aad/src/test/java/com/microsoft/azure/test/oauth/OAuthUtils.java diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-application/pom.xml b/sdk/spring/azure-spring-boot-test-application/pom.xml similarity index 86% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-application/pom.xml rename to sdk/spring/azure-spring-boot-test-application/pom.xml index 0027764d24c2..3eea8727fc7d 100644 --- a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-application/pom.xml +++ b/sdk/spring/azure-spring-boot-test-application/pom.xml @@ -10,9 +10,9 @@ 4.0.0 - com.microsoft.azure + com.azure azure-spring-boot-test-application - 1.0.0 + 1.0.0 jar @@ -25,13 +25,11 @@ org.springframework.boot spring-boot-starter-web - 2.3.0.RELEASE org.springframework.boot spring-boot-starter-test - 2.3.0.RELEASE test diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-application/src/main/java/com/microsoft/azure/config/IncreaseStartupTimeHelper.java b/sdk/spring/azure-spring-boot-test-application/src/main/java/com/microsoft/azure/config/IncreaseStartupTimeHelper.java similarity index 100% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-application/src/main/java/com/microsoft/azure/config/IncreaseStartupTimeHelper.java rename to sdk/spring/azure-spring-boot-test-application/src/main/java/com/microsoft/azure/config/IncreaseStartupTimeHelper.java diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-application/src/main/java/com/microsoft/azure/test/Application.java b/sdk/spring/azure-spring-boot-test-application/src/main/java/com/microsoft/azure/test/Application.java similarity index 100% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-application/src/main/java/com/microsoft/azure/test/Application.java rename to sdk/spring/azure-spring-boot-test-application/src/main/java/com/microsoft/azure/test/Application.java diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-application/src/main/resources/application.properties b/sdk/spring/azure-spring-boot-test-application/src/main/resources/application.properties similarity index 100% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-application/src/main/resources/application.properties rename to sdk/spring/azure-spring-boot-test-application/src/main/resources/application.properties diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-application/src/main/resources/assembly/zip.xml b/sdk/spring/azure-spring-boot-test-application/src/main/resources/assembly/zip.xml similarity index 100% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-application/src/main/resources/assembly/zip.xml rename to sdk/spring/azure-spring-boot-test-application/src/main/resources/assembly/zip.xml diff --git a/sdk/spring/azure-spring-boot-test-core/README.md b/sdk/spring/azure-spring-boot-test-core/README.md new file mode 100644 index 000000000000..a20e9ce11abe --- /dev/null +++ b/sdk/spring/azure-spring-boot-test-core/README.md @@ -0,0 +1,9 @@ +# Azure Spring Boot Integration tests client library for Java + +## Key concepts +## Getting started +## Key concepts +## Examples +## Troubleshooting +## Next steps +## Contributing diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-core/pom.xml b/sdk/spring/azure-spring-boot-test-core/pom.xml similarity index 81% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-core/pom.xml rename to sdk/spring/azure-spring-boot-test-core/pom.xml index 5acfaf3cb63b..1752fd094fcd 100644 --- a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-core/pom.xml +++ b/sdk/spring/azure-spring-boot-test-core/pom.xml @@ -3,14 +3,16 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - azure-spring-boot-tests - com.microsoft.azure - 2.3.3-beta.1 - ../pom.xml + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent 4.0.0 + com.azure azure-spring-boot-test-core + 1.0.0 jar @@ -95,14 +97,14 @@ com.azure:* com.microsoft.azure:* - com.jcraft:jsch:[0.1.53] - com.github.cverges.expect4j:expect4j:[1.6] - org.apache.maven:maven-embedder:[3.6.2] - org.apache.maven:maven-compat:[3.6.2] - org.apache.maven.wagon:wagon-http:[3.3.4] - org.apache.maven.wagon:wagon-provider-api:[3.3.4] - org.eclipse.aether:aether-connector-basic:[1.1.0] - org.eclipse.aether:aether-transport-wagon:[1.1.0] + com.jcraft:jsch:[0.1.53] + com.github.cverges.expect4j:expect4j:[1.6] + org.apache.maven:maven-embedder:[3.6.2] + org.apache.maven:maven-compat:[3.6.2] + org.apache.maven.wagon:wagon-http:[3.3.4] + org.apache.maven.wagon:wagon-provider-api:[3.3.4] + org.eclipse.aether:aether-connector-basic:[1.1.0] + org.eclipse.aether:aether-transport-wagon:[1.1.0] org.springframework.boot:spring-boot:[2.3.0.RELEASE] org.springframework.boot:spring-boot-starter-web:[2.3.0.RELEASE] org.springframework:spring-context:[5.2.6.RELEASE] @@ -111,14 +113,6 @@ - - org.apache.maven.plugins - maven-failsafe-plugin - 2.22.0 - - ${skipSpringITs} - - diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-core/src/main/java/com/microsoft/azure/test/management/Access.java b/sdk/spring/azure-spring-boot-test-core/src/main/java/com/microsoft/azure/test/management/Access.java similarity index 100% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-core/src/main/java/com/microsoft/azure/test/management/Access.java rename to sdk/spring/azure-spring-boot-test-core/src/main/java/com/microsoft/azure/test/management/Access.java diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-core/src/main/java/com/microsoft/azure/test/management/ClientSecretAccess.java b/sdk/spring/azure-spring-boot-test-core/src/main/java/com/microsoft/azure/test/management/ClientSecretAccess.java similarity index 100% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-core/src/main/java/com/microsoft/azure/test/management/ClientSecretAccess.java rename to sdk/spring/azure-spring-boot-test-core/src/main/java/com/microsoft/azure/test/management/ClientSecretAccess.java diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-core/src/main/java/com/microsoft/azure/test/utils/AppRunner.java b/sdk/spring/azure-spring-boot-test-core/src/main/java/com/microsoft/azure/test/utils/AppRunner.java similarity index 100% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-core/src/main/java/com/microsoft/azure/test/utils/AppRunner.java rename to sdk/spring/azure-spring-boot-test-core/src/main/java/com/microsoft/azure/test/utils/AppRunner.java diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-core/src/main/java/com/microsoft/azure/test/utils/MavenBasedProject.java b/sdk/spring/azure-spring-boot-test-core/src/main/java/com/microsoft/azure/test/utils/MavenBasedProject.java similarity index 100% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-core/src/main/java/com/microsoft/azure/test/utils/MavenBasedProject.java rename to sdk/spring/azure-spring-boot-test-core/src/main/java/com/microsoft/azure/test/utils/MavenBasedProject.java diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-core/src/main/java/com/microsoft/azure/test/utils/SSHShell.java b/sdk/spring/azure-spring-boot-test-core/src/main/java/com/microsoft/azure/test/utils/SSHShell.java similarity index 100% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-core/src/main/java/com/microsoft/azure/test/utils/SSHShell.java rename to sdk/spring/azure-spring-boot-test-core/src/main/java/com/microsoft/azure/test/utils/SSHShell.java diff --git a/sdk/spring/azure-spring-boot-test-cosmosdb/README.md b/sdk/spring/azure-spring-boot-test-cosmosdb/README.md new file mode 100644 index 000000000000..a20e9ce11abe --- /dev/null +++ b/sdk/spring/azure-spring-boot-test-cosmosdb/README.md @@ -0,0 +1,9 @@ +# Azure Spring Boot Integration tests client library for Java + +## Key concepts +## Getting started +## Key concepts +## Examples +## Troubleshooting +## Next steps +## Contributing diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-cosmosdb/pom.xml b/sdk/spring/azure-spring-boot-test-cosmosdb/pom.xml similarity index 79% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-cosmosdb/pom.xml rename to sdk/spring/azure-spring-boot-test-cosmosdb/pom.xml index ca98c2dde5d3..37f3956c8e7a 100644 --- a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-cosmosdb/pom.xml +++ b/sdk/spring/azure-spring-boot-test-cosmosdb/pom.xml @@ -3,14 +3,16 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - azure-spring-boot-tests - com.microsoft.azure - 2.3.3-beta.1 - ../pom.xml + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent 4.0.0 + com.azure azure-spring-boot-test-cosmosdb + 1.0.0 @@ -19,9 +21,9 @@ 2.3.3-beta.1 - com.microsoft.azure + com.azure azure-spring-boot-test-core - 2.3.3-beta.1 + 1.0.0 org.springframework.boot @@ -31,6 +33,10 @@ + + true + + diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-cosmosdb/src/test/java/com/microsoft/azure/test/cosmosdb/CosmosDBIT.java b/sdk/spring/azure-spring-boot-test-cosmosdb/src/test/java/com/microsoft/azure/test/cosmosdb/CosmosDBIT.java similarity index 100% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-cosmosdb/src/test/java/com/microsoft/azure/test/cosmosdb/CosmosDBIT.java rename to sdk/spring/azure-spring-boot-test-cosmosdb/src/test/java/com/microsoft/azure/test/cosmosdb/CosmosDBIT.java diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-cosmosdb/src/test/java/com/microsoft/azure/test/cosmosdb/DummyApp.java b/sdk/spring/azure-spring-boot-test-cosmosdb/src/test/java/com/microsoft/azure/test/cosmosdb/DummyApp.java similarity index 100% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-cosmosdb/src/test/java/com/microsoft/azure/test/cosmosdb/DummyApp.java rename to sdk/spring/azure-spring-boot-test-cosmosdb/src/test/java/com/microsoft/azure/test/cosmosdb/DummyApp.java diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-cosmosdb/src/test/java/com/microsoft/azure/test/cosmosdb/User.java b/sdk/spring/azure-spring-boot-test-cosmosdb/src/test/java/com/microsoft/azure/test/cosmosdb/User.java similarity index 100% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-cosmosdb/src/test/java/com/microsoft/azure/test/cosmosdb/User.java rename to sdk/spring/azure-spring-boot-test-cosmosdb/src/test/java/com/microsoft/azure/test/cosmosdb/User.java diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-cosmosdb/src/test/java/com/microsoft/azure/test/cosmosdb/UserRepository.java b/sdk/spring/azure-spring-boot-test-cosmosdb/src/test/java/com/microsoft/azure/test/cosmosdb/UserRepository.java similarity index 100% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-cosmosdb/src/test/java/com/microsoft/azure/test/cosmosdb/UserRepository.java rename to sdk/spring/azure-spring-boot-test-cosmosdb/src/test/java/com/microsoft/azure/test/cosmosdb/UserRepository.java diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-cosmosdb/test-resources.json b/sdk/spring/azure-spring-boot-test-cosmosdb/test-resources.json similarity index 100% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-cosmosdb/test-resources.json rename to sdk/spring/azure-spring-boot-test-cosmosdb/test-resources.json diff --git a/sdk/spring/azure-spring-boot-test-keyvault/README.md b/sdk/spring/azure-spring-boot-test-keyvault/README.md new file mode 100644 index 000000000000..a20e9ce11abe --- /dev/null +++ b/sdk/spring/azure-spring-boot-test-keyvault/README.md @@ -0,0 +1,9 @@ +# Azure Spring Boot Integration tests client library for Java + +## Key concepts +## Getting started +## Key concepts +## Examples +## Troubleshooting +## Next steps +## Contributing diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-keyvault/pom.xml b/sdk/spring/azure-spring-boot-test-keyvault/pom.xml similarity index 81% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-keyvault/pom.xml rename to sdk/spring/azure-spring-boot-test-keyvault/pom.xml index 8f413b404d1c..d206c8c9c94b 100644 --- a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-keyvault/pom.xml +++ b/sdk/spring/azure-spring-boot-test-keyvault/pom.xml @@ -3,14 +3,16 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - azure-spring-boot-tests - com.microsoft.azure - 2.3.3-beta.1 - ../pom.xml + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent 4.0.0 + com.azure azure-spring-boot-test-keyvault + 1.0.0 @@ -35,9 +37,9 @@ 2.3.3-beta.1 - com.microsoft.azure + com.azure azure-spring-boot-test-core - 2.3.3-beta.1 + 1.0.0 com.microsoft.azure @@ -54,9 +56,12 @@ - + + true + + @@ -67,9 +72,10 @@ + com.azure:* com.microsoft.azure:* - org.springframework.boot:spring-boot-starter-actuator:[2.3.0.RELEASE] - org.springframework.boot:spring-boot-starter-web:[2.3.0.RELEASE] + org.springframework.boot:spring-boot-starter-actuator:[2.3.0.RELEASE] + org.springframework.boot:spring-boot-starter-web:[2.3.0.RELEASE] diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-keyvault/src/test/java/com/microsoft/azure/test/keyvault/ActuatorIT.java b/sdk/spring/azure-spring-boot-test-keyvault/src/test/java/com/microsoft/azure/test/keyvault/ActuatorIT.java similarity index 100% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-keyvault/src/test/java/com/microsoft/azure/test/keyvault/ActuatorIT.java rename to sdk/spring/azure-spring-boot-test-keyvault/src/test/java/com/microsoft/azure/test/keyvault/ActuatorIT.java diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-keyvault/src/test/java/com/microsoft/azure/test/keyvault/KeyVaultIT.java b/sdk/spring/azure-spring-boot-test-keyvault/src/test/java/com/microsoft/azure/test/keyvault/KeyVaultIT.java similarity index 100% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-keyvault/src/test/java/com/microsoft/azure/test/keyvault/KeyVaultIT.java rename to sdk/spring/azure-spring-boot-test-keyvault/src/test/java/com/microsoft/azure/test/keyvault/KeyVaultIT.java diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-keyvault/src/test/java/com/microsoft/azure/test/keyvault/MultipleKeyVaultsIT.java b/sdk/spring/azure-spring-boot-test-keyvault/src/test/java/com/microsoft/azure/test/keyvault/MultipleKeyVaultsIT.java similarity index 100% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-keyvault/src/test/java/com/microsoft/azure/test/keyvault/MultipleKeyVaultsIT.java rename to sdk/spring/azure-spring-boot-test-keyvault/src/test/java/com/microsoft/azure/test/keyvault/MultipleKeyVaultsIT.java diff --git a/sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-keyvault/test-resources.json b/sdk/spring/azure-spring-boot-test-keyvault/test-resources.json similarity index 100% rename from sdk/spring/azure-spring-boot-tests/azure-spring-boot-test-keyvault/test-resources.json rename to sdk/spring/azure-spring-boot-test-keyvault/test-resources.json diff --git a/sdk/spring/azure-spring-boot-tests/README.md b/sdk/spring/azure-spring-boot-tests/README.md deleted file mode 100644 index 928b7a2efe58..000000000000 --- a/sdk/spring/azure-spring-boot-tests/README.md +++ /dev/null @@ -1,18 +0,0 @@ -#Azure Spring Boot Integration tests client library for Java - -## Key concepts -The structure of integration tests are organized as: - -- azure-spring-boot-tests (top folder for integration tests) - - azure-spring-boot-test-core (common code shared by integration tests) - - azure-spring-boot-test-keyvault (integration tests for key vault starter) - - azure-spring-boot-test-aad (integration tests for aad starter) - - azure-spring-boot-test-cosmosdb (integration tests for cosmos starter) - - azure-spring-boot-test-application (an application used by other integration tests) - -## Getting started -## Key concepts -## Examples -## Troubleshooting -## Next steps -## Contributing diff --git a/sdk/spring/azure-spring-boot-tests/pom.xml b/sdk/spring/azure-spring-boot-tests/pom.xml deleted file mode 100644 index 2647b21503a5..000000000000 --- a/sdk/spring/azure-spring-boot-tests/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - 4.0.0 - - - com.azure - azure-client-sdk-parent - 1.7.0 - ../../parents/azure-client-sdk-parent - - - com.microsoft.azure - azure-spring-boot-tests - 2.3.3-beta.1 - pom - - Azure Spring Boot Tests - Tests for Azure Spring Boot - - - azure-spring-boot-test-core - azure-spring-boot-test-application - azure-spring-boot-test-aad - azure-spring-boot-test-cosmosdb - azure-spring-boot-test-keyvault - - - - true - - - diff --git a/sdk/spring/azure-spring-boot/pom.xml b/sdk/spring/azure-spring-boot/pom.xml index 5f85a2bf9504..00f9045da2c9 100644 --- a/sdk/spring/azure-spring-boot/pom.xml +++ b/sdk/spring/azure-spring-boot/pom.xml @@ -166,7 +166,7 @@ com.azure azure-identity - 1.0.7 + 1.0.8 diff --git a/sdk/spring/azure-spring-boot/src/main/resources/META-INF/spring.factories b/sdk/spring/azure-spring-boot/src/main/resources/META-INF/spring.factories index 585ba02e906a..77ad8951f70a 100644 --- a/sdk/spring/azure-spring-boot/src/main/resources/META-INF/spring.factories +++ b/sdk/spring/azure-spring-boot/src/main/resources/META-INF/spring.factories @@ -6,4 +6,7 @@ com.microsoft.azure.spring.autoconfigure.cosmosdb.CosmosDbReactiveRepositoriesAu com.microsoft.azure.spring.autoconfigure.gremlin.GremlinAutoConfiguration,\ com.microsoft.azure.spring.autoconfigure.gremlin.GremlinRepositoriesAutoConfiguration,\ com.microsoft.azure.spring.autoconfigure.aad.AADAuthenticationFilterAutoConfiguration,\ -com.microsoft.azure.spring.autoconfigure.aad.AADOAuth2AutoConfiguration +com.microsoft.azure.spring.autoconfigure.aad.AADOAuth2AutoConfiguration,\ +com.microsoft.azure.spring.autoconfigure.btoc.AADB2CAutoConfiguration,\ +com.microsoft.azure.spring.autoconfigure.metrics.AzureMonitorMetricsExportAutoConfiguration,\ +com.microsoft.azure.spring.autoconfigure.jms.ServiceBusJMSAutoConfiguration diff --git a/sdk/spring/ci.yml b/sdk/spring/ci.yml index 7ccde32252d2..a2cfbd7ba4e1 100644 --- a/sdk/spring/ci.yml +++ b/sdk/spring/ci.yml @@ -56,31 +56,29 @@ extends: groupId: com.microsoft.azure safeName: azurespringbootstarterservicebusjms AdditionalModules: - - name: azure-spring-boot-samples - groupId: com.microsoft.azure - name: azure-spring-boot-sample-active-directory - groupId: com.microsoft.azure + groupId: com.azure - name: azure-spring-boot-sample-active-directory-b2c-oidc - groupId: com.microsoft.azure + groupId: com.azure - name: azure-spring-boot-sample-active-directory-backend - groupId: com.microsoft.azure + groupId: com.azure - name: azure-spring-boot-sample-active-directory-backend-v2 - groupId: com.microsoft.azure + groupId: com.azure - name: azure-spring-boot-sample-active-directory-stateless - groupId: com.microsoft.azure + groupId: com.azure - name: azure-spring-boot-sample-cosmosdb - groupId: com.microsoft.azure + groupId: com.azure - name: azure-spring-boot-sample-data-gremlin - groupId: com.microsoft.azure + groupId: com.azure - name: azure-spring-boot-sample-keyvault-secrets - groupId: com.microsoft.azure + groupId: com.azure - name: azure-spring-boot-sample-mediaservices - groupId: com.microsoft.azure + groupId: com.azure - name: azure-spring-boot-sample-servicebus - groupId: com.microsoft.azure + groupId: com.azure - name: azure-spring-boot-sample-servicebus-jms-queue - groupId: com.microsoft.azure + groupId: com.azure - name: azure-spring-boot-sample-servicebus-jms-topic - groupId: com.microsoft.azure + groupId: com.azure - name: azure-spring-boot-sample-storage-blob - groupId: com.microsoft.azure + groupId: com.azure diff --git a/sdk/spring/pom.xml b/sdk/spring/pom.xml index b9e7c1e1216c..3ff7a064ef50 100644 --- a/sdk/spring/pom.xml +++ b/sdk/spring/pom.xml @@ -18,8 +18,25 @@ azure-spring-boot-starter-keyvault-secrets azure-spring-boot-starter-metrics azure-spring-boot-starter-servicebus-jms - azure-spring-boot-samples - azure-spring-boot-tests + azure-spring-boot-test-application + azure-spring-boot-test-core + azure-spring-boot-test-aad + azure-spring-boot-test-cosmosdb + azure-spring-boot-test-keyvault + azure-spring-boot-samples/azure-spring-boot-sample-active-directory + azure-spring-boot-samples/azure-spring-boot-sample-active-directory-b2c-oidc + azure-spring-boot-samples/azure-spring-boot-sample-active-directory-backend + azure-spring-boot-samples/azure-spring-boot-sample-active-directory-backend-v2 + azure-spring-boot-samples/azure-spring-boot-sample-active-directory-stateless + azure-spring-boot-samples/azure-spring-boot-sample-cosmosdb + azure-spring-boot-samples/azure-spring-boot-sample-data-gremlin + azure-spring-boot-samples/azure-spring-boot-sample-keyvault-secrets + azure-spring-boot-samples/azure-spring-boot-sample-mediaservices + azure-spring-boot-samples/azure-spring-boot-sample-servicebus + azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-queue + azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-topic + azure-spring-boot-samples/azure-spring-boot-sample-storage-blob + azure-spring-boot-samples/azure-cloud-foundry-service-sample diff --git a/sdk/spring/tests.yml b/sdk/spring/tests.yml index 0a51f922ad7b..df60d67043f0 100644 --- a/sdk/spring/tests.yml +++ b/sdk/spring/tests.yml @@ -10,23 +10,21 @@ jobs: goals: "verify" Artifacts: - - name: azure-spring-boot-tests - groupId: com.microsoft.azure - safeName: azurespringboot-tests + - name: azure-spring-boot-test-application + groupId: com.azure + safeName: azurespringboottestapplication - name: azure-spring-boot-test-core - groupId: com.microsoft.azure + groupId: com.azure safeName: azurespringboottestcore - name: azure-spring-boot-test-cosmosdb - groupId: com.microsoft.azure + groupId: com.azure safeName: azurespringboottestcosmosdb - name: azure-spring-boot-test-aad - groupId: com.microsoft.azure + groupId: com.azure safeName: azurespringboottestaad - name: azure-spring-boot-test-keyvault - groupId: com.microsoft.azure + groupId: com.azure safeName: azurespringboottestkeyvault - - name: azure-spring-boot-test-application - groupId: com.microsoft.azure - safeName: azurespringboottestapplication + EnvVars: AZURE_TEST_MODE: LIVE diff --git a/sdk/sql/mgmt/src/main/java/com/azure/resourcemanager/sql/SqlManagementClient.java b/sdk/sql/mgmt/src/main/java/com/azure/resourcemanager/sql/SqlManagementClient.java index d67792b394e7..2468a97fc933 100644 --- a/sdk/sql/mgmt/src/main/java/com/azure/resourcemanager/sql/SqlManagementClient.java +++ b/sdk/sql/mgmt/src/main/java/com/azure/resourcemanager/sql/SqlManagementClient.java @@ -8,7 +8,7 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.management.AzureEnvironment; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.AzureServiceClient; +import com.azure.resourcemanager.resources.fluentcore.AzureServiceClient; import com.azure.resourcemanager.sql.fluent.BackupLongTermRetentionPoliciesClient; import com.azure.resourcemanager.sql.fluent.BackupShortTermRetentionPoliciesClient; import com.azure.resourcemanager.sql.fluent.CapabilitiesClient; diff --git a/sdk/storage/azure-storage-blob-batch/CHANGELOG.md b/sdk/storage/azure-storage-blob-batch/CHANGELOG.md index 450eed0d2ab1..e8ff9375b1d5 100644 --- a/sdk/storage/azure-storage-blob-batch/CHANGELOG.md +++ b/sdk/storage/azure-storage-blob-batch/CHANGELOG.md @@ -1,6 +1,10 @@ # Release History -## 12.6.0-beta.1 (Unreleased) +## 12.6.0-beta.2 (Unreleased) + + +## 12.6.0-beta.1 (2020-07-07) +- Updated azure-storage-common and azure-storage-blob dependencies to add support for the 2019-12-12 service version. ## 12.5.2 (2020-06-12) - Updated azure-storage-common and azure-core dependencies. diff --git a/sdk/storage/azure-storage-blob-batch/README.md b/sdk/storage/azure-storage-blob-batch/README.md index e36e5cd185f9..862214cfb0de 100644 --- a/sdk/storage/azure-storage-blob-batch/README.md +++ b/sdk/storage/azure-storage-blob-batch/README.md @@ -22,7 +22,7 @@ definition, such as text or binary data. com.azure azure-storage-blob-batch - 12.5.2 + 12.6.0-beta.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/storage/azure-storage-blob-batch/pom.xml b/sdk/storage/azure-storage-blob-batch/pom.xml index 9834337dc64c..486e4b999119 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.6.0-beta.1 + 12.6.0-beta.2 Microsoft Azure client library for Blob Storage batching This module contains client library for Microsoft Azure Blob Storage batching. @@ -55,7 +55,7 @@ com.azure azure-core - 1.6.0 + 1.7.0-beta.1 com.azure @@ -65,7 +65,7 @@ com.azure azure-storage-blob - 12.8.0-beta.1 + 12.8.0-beta.2 + 1.0.8 test diff --git a/sdk/storage/azure-storage-blob-changefeed/CHANGELOG.md b/sdk/storage/azure-storage-blob-changefeed/CHANGELOG.md index db455f5b1307..7fbb4c5ad130 100644 --- a/sdk/storage/azure-storage-blob-changefeed/CHANGELOG.md +++ b/sdk/storage/azure-storage-blob-changefeed/CHANGELOG.md @@ -1,6 +1,9 @@ # Release History -## 12.0.0-beta.1 (Unreleased) +## 12.0.0-beta.2 (Unreleased) + + +## 12.0.0-beta.1 (2020-07-07) - Initial release. - Added support to get changefeed events for an account. diff --git a/sdk/storage/azure-storage-blob-changefeed/pom.xml b/sdk/storage/azure-storage-blob-changefeed/pom.xml index 7cfe14796bbb..f2036082b632 100644 --- a/sdk/storage/azure-storage-blob-changefeed/pom.xml +++ b/sdk/storage/azure-storage-blob-changefeed/pom.xml @@ -13,7 +13,7 @@ com.azure azure-storage-blob-changefeed - 12.0.0-beta.1 + 12.0.0-beta.2 Microsoft Azure client library for Blob Storage changefeed This module contains client library for Microsoft Azure Blob Storage changefeed. @@ -55,7 +55,7 @@ com.azure azure-core - 1.6.0 + 1.7.0-beta.1 com.azure @@ -65,7 +65,7 @@ com.azure azure-storage-blob - 12.8.0-beta.1 + 12.8.0-beta.2 + 1.0.8 test diff --git a/sdk/storage/azure-storage-blob-cryptography/CHANGELOG.md b/sdk/storage/azure-storage-blob-cryptography/CHANGELOG.md index 76fa6226f866..79529aabe129 100644 --- a/sdk/storage/azure-storage-blob-cryptography/CHANGELOG.md +++ b/sdk/storage/azure-storage-blob-cryptography/CHANGELOG.md @@ -1,6 +1,9 @@ # Release History -## 12.8.0-beta.1 (Unreleased) +## 12.8.0-beta.2 (Unreleased) + + +## 12.8.0-beta.1 (2020-07-07) - Added support for setting blob tags on upload. ## 12.7.0 (2020-06-12) diff --git a/sdk/storage/azure-storage-blob-cryptography/README.md b/sdk/storage/azure-storage-blob-cryptography/README.md index 2faa193ce2cf..efab887e6280 100644 --- a/sdk/storage/azure-storage-blob-cryptography/README.md +++ b/sdk/storage/azure-storage-blob-cryptography/README.md @@ -21,7 +21,7 @@ This package supports client side encryption for blob storage. com.azure azure-storage-blob-cryptography - 12.7.0 + 12.8.0-beta.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/storage/azure-storage-blob-cryptography/pom.xml b/sdk/storage/azure-storage-blob-cryptography/pom.xml index cf6cc2e0eb7d..f4eeeba0f833 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.8.0-beta.1 + 12.8.0-beta.2 Microsoft Azure client library for Blob Storage cryptography This module contains client library for Microsoft Azure Blob Storage cryptography. @@ -41,7 +41,7 @@ com.azure azure-core - 1.6.0 + 1.7.0-beta.1 com.azure @@ -51,7 +51,7 @@ com.azure azure-storage-blob - 12.8.0-beta.1 + 12.8.0-beta.2 com.azure @@ -95,7 +95,7 @@ com.azure azure-identity - 1.0.7 + 1.0.8 test diff --git a/sdk/storage/azure-storage-blob-nio/pom.xml b/sdk/storage/azure-storage-blob-nio/pom.xml index 2d8868268245..9b04ff9c4c40 100644 --- a/sdk/storage/azure-storage-blob-nio/pom.xml +++ b/sdk/storage/azure-storage-blob-nio/pom.xml @@ -54,7 +54,7 @@ com.azure azure-storage-blob - 12.8.0-beta.1 + 12.8.0-beta.2 diff --git a/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureBasicFileAttributeView.java b/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureBasicFileAttributeView.java new file mode 100644 index 000000000000..4a0766ac4284 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureBasicFileAttributeView.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob.nio; + +import java.io.IOException; +import java.nio.file.Path; +import java.nio.file.attribute.BasicFileAttributeView; +import java.nio.file.attribute.FileTime; + +/** + * Provides support for basic file attributes. + * + * The operations supported by this view and the attributes it reads are a strict subset of + * {@link AzureBlobFileAttributeView} and has the same network behavior. Therefore, while this type is offered for + * compliance with the NIO spec, {@link AzureBlobFileAttributeView} is generally preferred. + * + * {@link #setTimes(FileTime, FileTime, FileTime)} is not supported. + * + * {@inheritDoc} + */ +public final class AzureBasicFileAttributeView implements BasicFileAttributeView { + + private final Path path; + + AzureBasicFileAttributeView(Path path) { + this.path = path; + } + + /** + * Returns {@code "azureBasic"} + * {@inheritDoc} + */ + @Override + public String name() { + return "azureBasic"; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureBasicFileAttributes readAttributes() throws IOException { + return new AzureBasicFileAttributes(path); + } + + /** + * Unsupported. + * + * @throws UnsupportedOperationException Operation not supported. + * {@inheritDoc} + */ + @Override + public void setTimes(FileTime lastModifiedTime, FileTime lastAccessTime, FileTime createTime) throws IOException { + throw new UnsupportedOperationException(); + } +} diff --git a/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureBasicFileAttributes.java b/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureBasicFileAttributes.java new file mode 100644 index 000000000000..b6c2d555a090 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureBasicFileAttributes.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob.nio; + +import com.azure.core.util.logging.ClientLogger; +import com.azure.storage.blob.models.BlobProperties; +import com.azure.storage.blob.models.BlobStorageException; + +import java.io.IOException; +import java.nio.file.Path; +import java.nio.file.attribute.BasicFileAttributes; +import java.nio.file.attribute.FileAttribute; +import java.nio.file.attribute.FileTime; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +/** + * Provides support for basic file attributes. + *

+ * The properties available on this type are a strict subset of {@link AzureBlobFileAttributes}, and the two types have + * the same network behavior. Therefore, while this type is offered for compliance with the NIO spec, + * {@link AzureBlobFileAttributes} is generally preferred. + *

+ * Some attributes are not supported. Refer to the javadocs on each method for more information. + * {@inheritDoc} + */ +public class AzureBasicFileAttributes implements BasicFileAttributes { + private final ClientLogger logger = new ClientLogger(AzureBasicFileAttributes.class); + + // For verifying parameters on FileSystemProvider.readAttributes + static final Set ATTRIBUTE_STRINGS; + static { + Set set = new HashSet<>(); + set.add("lastModifiedTime"); + set.add("isRegularFile"); + set.add("isDirectory"); + set.add("isSymbolicLink"); + set.add("isOther"); + set.add("size"); + set.add("creationTime"); + ATTRIBUTE_STRINGS = Collections.unmodifiableSet(set); + } + + private final BlobProperties properties; + + /* + There are some work-arounds we could do to try to accommodate virtual directories such as making a checkDirStatus + call before or after getProperties to throw an appropriate error or adding an isVirtualDirectory method. However, + the former wastes network time only to throw a slightly more specific error when we will throw on 404 anyway. The + latter introduces virtual directories into the actual code path/api surface. While we are clear in our docs about + the possible pitfalls of virtual directories, and customers should be aware of it, they shouldn't have to code + against it. Therefore, we fall back to documenting that reading attributes on a virtual directory will throw. + */ + AzureBasicFileAttributes(Path path) throws IOException { + try { + this.properties = new AzureResource(path).getBlobClient().getProperties(); + } catch (BlobStorageException e) { + throw LoggingUtility.logError(logger, new IOException(e)); + } + } + + /** + * {@inheritDoc} + */ + @Override + public FileTime lastModifiedTime() { + return FileTime.from(properties.getLastModified().toInstant()); + } + + /** + * Unsupported. + * @throws UnsupportedOperationException Operation not supported. + * {@inheritDoc} + */ + @Override + public FileTime lastAccessTime() { + throw new UnsupportedOperationException(); + } + + /** + * {@inheritDoc} + */ + @Override + public FileTime creationTime() { + return FileTime.from(properties.getCreationTime().toInstant()); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isRegularFile() { + return !this.properties.getMetadata().getOrDefault(AzureResource.DIR_METADATA_MARKER, "false").equals("true"); + } + + /** + * {@inheritDoc} + *

+ * Will only return true if the directory is a concrete directory. See + * {@link AzureFileSystemProvider#createDirectory(Path, FileAttribute[])} for more information on virtual and + * concrete directories. + */ + @Override + public boolean isDirectory() { + return !this.isRegularFile(); + } + + /** + * @return false. Symbolic links are not supported. + */ + @Override + public boolean isSymbolicLink() { + return false; + } + + /** + * @return false + */ + @Override + public boolean isOther() { + return false; + } + + /** + * {@inheritDoc} + */ + @Override + public long size() { + return properties.getBlobSize(); + } + + /** + * Unsupported. + * @throws UnsupportedOperationException Operation not supported. + * {@inheritDoc} + */ + @Override + public Object fileKey() { + throw new UnsupportedOperationException(); + } +} diff --git a/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureBlobFileAttributeView.java b/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureBlobFileAttributeView.java new file mode 100644 index 000000000000..2761c54830b6 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureBlobFileAttributeView.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob.nio; + +import com.azure.core.util.logging.ClientLogger; +import com.azure.storage.blob.models.AccessTier; +import com.azure.storage.blob.models.BlobHttpHeaders; +import com.azure.storage.blob.models.BlobStorageException; +import com.azure.storage.blob.specialized.BlobClientBase; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.file.Path; +import java.nio.file.attribute.BasicFileAttributeView; +import java.nio.file.attribute.FileTime; +import java.util.HashMap; +import java.util.Map; +import java.util.function.Consumer; + +/** + * A file attribute view that provides a view of attributes specific to files stored as blobs in Azure Storage. + *

+ * All attributes are retrieved from the file system as a bulk operation. + *

+ * {@link #setTimes(FileTime, FileTime, FileTime)} is not supported. + */ +public final class AzureBlobFileAttributeView implements BasicFileAttributeView { + private final ClientLogger logger = new ClientLogger(AzureBlobFileAttributeView.class); + + static final String ATTR_CONSUMER_ERROR = "Exception thrown by attribute consumer"; + + private final Path path; + + AzureBlobFileAttributeView(Path path) { + this.path = path; + } + + @SuppressWarnings("unchecked") + static Map> setAttributeConsumers(AzureBlobFileAttributeView view) { + Map> map = new HashMap<>(); + map.put("blobHttpHeaders", obj -> { + try { + view.setBlobHttpHeaders((BlobHttpHeaders) obj); + } catch (IOException e) { + throw LoggingUtility.logError(view.logger, new UncheckedIOException(ATTR_CONSUMER_ERROR, e)); + } + }); + map.put("metadata", obj -> { + try { + Map m = (Map) obj; + if (m == null) { + throw LoggingUtility.logError(view.logger, new ClassCastException()); + } + view.setMetadata(m); + } catch (IOException e) { + throw LoggingUtility.logError(view.logger, new UncheckedIOException(ATTR_CONSUMER_ERROR, e)); + } + }); + map.put("tier", obj -> { + try { + view.setTier((AccessTier) obj); + } catch (IOException e) { + throw LoggingUtility.logError(view.logger, new UncheckedIOException(ATTR_CONSUMER_ERROR, e)); + } + }); + + return map; + } + + /** + * Returns "azureBlob". + * {@inheritDoc} + */ + @Override + public String name() { + return "azureBlob"; + } + + /** + * Reads the file attributes as a bulk operation. + * + * Gets a fresh copy every time it is called. + * @return {@link AzureBlobFileAttributes} + * @throws IOException if an IOException occurs. + */ + @Override + public AzureBlobFileAttributes readAttributes() throws IOException { + return new AzureBlobFileAttributes(path); + } + + /** + * Sets the {@link BlobHttpHeaders} as an atomic operation. + *

+ * See {@link BlobClientBase#setHttpHeaders(BlobHttpHeaders)} for more information. + * @param headers {@link BlobHttpHeaders} + * @throws IOException if an IOException occurs. + */ + public void setBlobHttpHeaders(BlobHttpHeaders headers) throws IOException { + try { + new AzureResource(this.path).getBlobClient().setHttpHeaders(headers); + } catch (BlobStorageException e) { + throw LoggingUtility.logError(logger, new IOException(e)); + } + } + + /** + * Sets the metadata as an atomic operation. + *

+ * See {@link BlobClientBase#setMetadata(Map)} for more information. + * @param metadata The metadata to associate with the blob + * @throws IOException if an IOException occurs. + */ + public void setMetadata(Map metadata) throws IOException { + try { + new AzureResource(this.path).getBlobClient().setMetadata(metadata); + } catch (BlobStorageException e) { + throw LoggingUtility.logError(logger, new IOException(e)); + } + } + + /** + * Sets the {@link AccessTier} on the file. + * + * See {@link BlobClientBase#setAccessTier(AccessTier)} for more information. + * @param tier {@link AccessTier} + * @throws IOException if an IOException occurs. + */ + public void setTier(AccessTier tier) throws IOException { + try { + new AzureResource(this.path).getBlobClient().setAccessTier(tier); + } catch (BlobStorageException e) { + throw LoggingUtility.logError(logger, new IOException(e)); + } + } + + /** + * Unsupported. + * + * @throws UnsupportedOperationException Operation not supported. + * {@inheritDoc} + */ + @Override + public void setTimes(FileTime fileTime, FileTime fileTime1, FileTime fileTime2) throws IOException { + throw new UnsupportedOperationException(); + } +} diff --git a/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureBlobFileAttributes.java b/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureBlobFileAttributes.java new file mode 100644 index 000000000000..7c8c25b7fe53 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureBlobFileAttributes.java @@ -0,0 +1,292 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob.nio; + +import com.azure.core.util.logging.ClientLogger; +import com.azure.storage.blob.models.AccessTier; +import com.azure.storage.blob.models.ArchiveStatus; +import com.azure.storage.blob.models.BlobHttpHeaders; +import com.azure.storage.blob.models.BlobProperties; +import com.azure.storage.blob.models.BlobStorageException; +import com.azure.storage.blob.models.BlobType; +import com.azure.storage.blob.models.CopyStatusType; + +import java.io.IOException; +import java.nio.file.Path; +import java.nio.file.attribute.BasicFileAttributes; +import java.nio.file.attribute.FileAttribute; +import java.nio.file.attribute.FileTime; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.function.Supplier; + +/** + * File attributes associated with a file stored as a blob in Azure Storage. + *

+ * Some of the attributes inherited from {@link BasicFileAttributes} are not supported. See the docs on each method for + * more information. + */ +public final class AzureBlobFileAttributes implements BasicFileAttributes { + /* + Some blob properties do not have getters as they do not make sense in the context of nio. These properties are: + - incremental snapshot related properties + - lease related properties + - sequence number + - encryption key sha256 + */ + + private final ClientLogger logger = new ClientLogger(AzureBlobFileAttributes.class); + + private final BlobProperties properties; + + AzureBlobFileAttributes(Path path) throws IOException { + try { + this.properties = new AzureResource(path).getBlobClient().getProperties(); + } catch (BlobStorageException e) { + throw LoggingUtility.logError(logger, new IOException("Path: " + path.toString(), e)); + } + } + + static Map> getAttributeSuppliers(AzureBlobFileAttributes attributes) { + Map> map = new HashMap<>(); + map.put("creationTime", attributes::creationTime); + map.put("lastModifiedTime", attributes::lastModifiedTime); + map.put("eTag", attributes::eTag); + map.put("blobHttpHeaders", attributes::blobHttpHeaders); + map.put("blobType", attributes::blobType); + map.put("copyId", attributes::copyId); + map.put("copyStatus", attributes::copyStatus); + map.put("copySource", attributes::copySource); + map.put("copyProgress", attributes::copyProgress); + map.put("copyCompletionTime", attributes::copyCompletionTime); + map.put("copyStatusDescription", attributes::copyStatusDescription); + map.put("isServerEncrypted", attributes::isServerEncrypted); + map.put("accessTier", attributes::accessTier); + map.put("isAccessTierInferred", attributes::isAccessTierInferred); + map.put("archiveStatus", attributes::archiveStatus); + map.put("accessTierChangeTime", attributes::accessTierChangeTime); + map.put("metadata", attributes::metadata); + map.put("committedBlockCount", attributes::committedBlockCount); + map.put("isRegularFile", attributes::isRegularFile); + map.put("isDirectory", attributes::isDirectory); + map.put("isSymbolicLink", attributes::isSymbolicLink); + map.put("isOther", attributes::isOther); + map.put("size", attributes::size); + return map; + } + + /** + * {@inheritDoc} + */ + @Override + public FileTime creationTime() { + return FileTime.from(this.properties.getCreationTime().toInstant()); + } + + /** + * {@inheritDoc} + */ + @Override + public FileTime lastModifiedTime() { + return FileTime.from(this.properties.getLastModified().toInstant()); + } + + /** + * @return the eTag of the blob + */ + public String eTag() { + return this.properties.getETag(); + } + + /** + * @return {@link BlobHttpHeaders} + */ + public BlobHttpHeaders blobHttpHeaders() { + /* + We return these all as one value so it's consistent with the way of setting, especially the setAttribute method + that accepts a string argument for the name of the property. Returning them individually would mean we have to + support setting them individually as well, which is not possible due to service constraints. + */ + return new BlobHttpHeaders() + .setContentType(this.properties.getContentType()) + .setContentLanguage(this.properties.getContentLanguage()) + .setContentMd5(this.properties.getContentMd5()) + .setContentDisposition(this.properties.getContentDisposition()) + .setContentEncoding(this.properties.getContentEncoding()) + .setCacheControl(this.properties.getCacheControl()); + } + + /** + * @return the type of the blob + */ + public BlobType blobType() { + return this.properties.getBlobType(); + } + + /** + * @return the identifier of the last copy operation. If this blob hasn't been the target of a copy operation or has + * been modified since this won't be set. + */ + public String copyId() { + return this.properties.getCopyId(); + } + + /** + * @return the status of the last copy operation. If this blob hasn't been the target of a copy operation or has + * been modified since this won't be set. + */ + public CopyStatusType copyStatus() { + return this.properties.getCopyStatus(); + } + + /** + * @return the source blob URL from the last copy operation. If this blob hasn't been the target of a copy operation + * or has been modified since this won't be set. + */ + public String copySource() { + return this.properties.getCopySource(); + } + + /** + * @return the number of bytes copied and total bytes in the source from the last copy operation (bytes copied/total + * bytes). If this blob hasn't been the target of a copy operation or has been modified since this won't be set. + */ + public String copyProgress() { + return this.properties.getCopyProgress(); + } + + /** + * @return the completion time of the last copy operation. If this blob hasn't been the target of a copy operation + * or has been modified since this won't be set. + */ + public OffsetDateTime copyCompletionTime() { + return this.properties.getCopyCompletionTime(); + } + + /** + * @return the description of the last copy failure, this is set when the {@link #copyStatus() getCopyStatus} is + * {@link CopyStatusType#FAILED failed} or {@link CopyStatusType#ABORTED aborted}. If this blob hasn't been the + * target of a copy operation or has been modified since this won't be set. + */ + public String copyStatusDescription() { + return this.properties.getCopyStatusDescription(); + } + + /** + * @return the status of the blob being encrypted on the server + */ + public Boolean isServerEncrypted() { + return this.properties.isServerEncrypted(); + } + + /** + * @return the tier of the blob. This is only set for Page blobs on a premium storage account or for Block blobs on + * blob storage or general purpose V2 account. + */ + public AccessTier accessTier() { + return this.properties.getAccessTier(); + } + + /** + * @return the status of the tier being inferred for the blob. This is only set for Page blobs on a premium storage + * account or for Block blobs on blob storage or general purpose V2 account. + */ + public Boolean isAccessTierInferred() { + return this.properties.isAccessTierInferred(); + } + + /** + * @return the archive status of the blob. This is only for blobs on a blob storage and general purpose v2 account. + */ + public ArchiveStatus archiveStatus() { + return this.properties.getArchiveStatus(); + } + + /** + * @return the time when the access tier for the blob was last changed + */ + public OffsetDateTime accessTierChangeTime() { + return this.properties.getAccessTierChangeTime(); + } + + /** + * @return the metadata associated with this blob + */ + public Map metadata() { + return Collections.unmodifiableMap(this.properties.getMetadata()); + } + + /** + * @return the number of committed blocks in the blob. This is only returned for Append blobs. + */ + public Integer committedBlockCount() { + return this.properties.getCommittedBlockCount(); + } + + /** + * Unsupported. + * @throws UnsupportedOperationException Operation not supported. + * {@inheritDoc} + */ + @Override + public FileTime lastAccessTime() { + throw new UnsupportedOperationException(); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isRegularFile() { + return !this.properties.getMetadata().getOrDefault(AzureResource.DIR_METADATA_MARKER, "false").equals("true"); + } + + /** + * {@inheritDoc} + *

+ * Will only return true if the directory is a concrete directory. See + * {@link AzureFileSystemProvider#createDirectory(Path, FileAttribute[])} for more information on virtual and + * concrete directories. + */ + @Override + public boolean isDirectory() { + return !this.isRegularFile(); + } + + /** + * @return false. Symbolic links are not supported. + */ + @Override + public boolean isSymbolicLink() { + return false; + } + + /** + * @return false + */ + @Override + public boolean isOther() { + return false; + } + + /** + * {@inheritDoc} + */ + @Override + public long size() { + return properties.getBlobSize(); + } + + /** + * Unsupported. + * @throws UnsupportedOperationException Operation not supported. + * {@inheritDoc} + */ + @Override + public Object fileKey() { + throw new UnsupportedOperationException(); + } +} diff --git a/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureFileStore.java b/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureFileStore.java index 85559e72f1df..bf5507446bef 100644 --- a/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureFileStore.java +++ b/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureFileStore.java @@ -114,7 +114,7 @@ public long getUnallocatedSpace() throws IOException { *

    *
  • {@link java.nio.file.attribute.BasicFileAttributeView}
  • *
  • {@link java.nio.file.attribute.UserDefinedFileAttributeView}
  • - *
  • {@link AzureStorageFileAttributeView}
  • + *
  • {@link AzureBasicFileAttributeView}
  • *
* * {@inheritDoc} @@ -129,7 +129,7 @@ public boolean supportsFileAttributeView(Class aCla *
    *
  • {@link java.nio.file.attribute.BasicFileAttributeView}
  • *
  • {@link java.nio.file.attribute.UserDefinedFileAttributeView}
  • - *
  • {@link AzureStorageFileAttributeView}
  • + *
  • {@link AzureBasicFileAttributeView}
  • *
* * {@inheritDoc} diff --git a/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureFileSystem.java b/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureFileSystem.java index 9733383d2acf..423264e135b5 100644 --- a/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureFileSystem.java +++ b/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureFileSystem.java @@ -22,7 +22,6 @@ import java.nio.file.WatchService; import java.nio.file.attribute.BasicFileAttributeView; import java.nio.file.attribute.FileAttributeView; -import java.nio.file.attribute.UserDefinedFileAttributeView; import java.nio.file.attribute.UserPrincipalLookupService; import java.nio.file.spi.FileSystemProvider; @@ -129,8 +128,8 @@ public final class AzureFileSystem extends FileSystem { static { Map, String> map = new HashMap<>(); map.put(BasicFileAttributeView.class, "basic"); - map.put(UserDefinedFileAttributeView.class, "user"); - map.put(AzureStorageFileAttributeView.class, "azureStorage"); + map.put(AzureBasicFileAttributeView.class, "azureBasic"); + map.put(AzureBlobFileAttributeView.class, "azureBlob"); SUPPORTED_ATTRIBUTE_VIEWS = Collections.unmodifiableMap(map); } @@ -268,7 +267,7 @@ public Iterable getFileStores() { *
    *
  • {@link java.nio.file.attribute.BasicFileAttributeView}
  • *
  • {@link java.nio.file.attribute.UserDefinedFileAttributeView}
  • - *
  • {@link AzureStorageFileAttributeView}
  • + *
  • {@link AzureBasicFileAttributeView}
  • *
* * {@inheritDoc} diff --git a/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureFileSystemProvider.java b/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureFileSystemProvider.java index 25c5bd2b72d0..c212b1b35c35 100644 --- a/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureFileSystemProvider.java +++ b/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureFileSystemProvider.java @@ -17,6 +17,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.io.UncheckedIOException; import java.net.HttpURLConnection; import java.net.URI; import java.nio.channels.SeekableByteChannel; @@ -35,6 +36,7 @@ import java.nio.file.OpenOption; import java.nio.file.Path; import java.nio.file.StandardCopyOption; +import java.nio.file.attribute.BasicFileAttributeView; import java.nio.file.StandardOpenOption; import java.nio.file.attribute.BasicFileAttributes; import java.nio.file.attribute.FileAttribute; @@ -43,11 +45,14 @@ import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import java.util.function.Consumer; +import java.util.function.Supplier; /** * The {@code AzureFileSystemProvider} is Azure Storage's implementation of the nio interface on top of Azure Blob @@ -194,12 +199,13 @@ public Path getPath(URI uri) { } /** + * @throws UnsupportedOperationException Operation is not supported. * {@inheritDoc} */ @Override public SeekableByteChannel newByteChannel(Path path, Set set, FileAttribute... fileAttributes) throws IOException { - return null; + throw new UnsupportedOperationException(); } /** @@ -606,19 +612,21 @@ public void copy(Path source, Path destination, CopyOption... copyOptions) throw }*/ /** + * @throws UnsupportedOperationException Operation is not supported. * {@inheritDoc} */ @Override public void move(Path path, Path path1, CopyOption... copyOptions) throws IOException { - + throw new UnsupportedOperationException(); } /** + * @throws UnsupportedOperationException Operation is not supported. * {@inheritDoc} */ @Override public boolean isSameFile(Path path, Path path1) throws IOException { - return false; + throw new UnsupportedOperationException(); } /** @@ -630,52 +638,244 @@ public boolean isHidden(Path path) throws IOException { } /** + * @throws UnsupportedOperationException Operation is not supported. * {@inheritDoc} */ @Override public FileStore getFileStore(Path path) throws IOException { - return null; + throw new UnsupportedOperationException(); } /** + * @throws UnsupportedOperationException Operation is not supported. * {@inheritDoc} */ @Override public void checkAccess(Path path, AccessMode... accessModes) throws IOException { - + throw new UnsupportedOperationException(); } /** + * Returns a file attribute view of a given type. + * + * See {@link AzureBasicFileAttributeView} and {@link AzureBlobFileAttributeView} for more information. + * + * Reading or setting attributes on a virtual directory is not supported and will throw an {@link IOException}. See + * {@link #createDirectory(Path, FileAttribute[])} for more information on virtual directories. * {@inheritDoc} */ @Override + @SuppressWarnings("unchecked") public V getFileAttributeView(Path path, Class aClass, LinkOption... linkOptions) { - return null; + /* + No resource validation is necessary here. That can happen at the time of making a network requests internal to + the view object. + */ + if (aClass == BasicFileAttributeView.class || aClass == AzureBasicFileAttributeView.class) { + return (V) new AzureBasicFileAttributeView(path); + } else if (aClass == AzureBlobFileAttributeView.class) { + return (V) new AzureBlobFileAttributeView(path); + } else { + return null; + } } /** + * Reads a file's attributes as a bulk operation. + * + * See {@link AzureBasicFileAttributes} and {@link AzureBlobFileAttributes} for more information. + * + * Reading attributes on a virtual directory is not supported and will throw an {@link IOException}. See + * {@link #createDirectory(Path, FileAttribute[])} for more information on virtual directories. * {@inheritDoc} */ @Override + @SuppressWarnings("unchecked") public A readAttributes(Path path, Class aClass, LinkOption... linkOptions) throws IOException { - return null; + Class view; + if (aClass == BasicFileAttributes.class || aClass == AzureBasicFileAttributes.class) { + view = AzureBasicFileAttributeView.class; + } else if (aClass == AzureBlobFileAttributes.class) { + view = AzureBlobFileAttributeView.class; + } else { + throw new UnsupportedOperationException(); + } + + /* + Resource validation will happen in readAttributes of the view. We don't want to double check, and checking + internal to the view ensures it is always checked no matter which code path is taken. + */ + return (A) getFileAttributeView(path, view, linkOptions).readAttributes(); } /** + * Reads a set of file attributes as a bulk operation. + * + * See {@link AzureBasicFileAttributes} and {@link AzureBlobFileAttributes} for more information. + * + * Reading attributes on a virtual directory is not supported and will throw an {@link IOException}. See + * {@link #createDirectory(Path, FileAttribute[])} for more information on virtual directories. * {@inheritDoc} */ @Override public Map readAttributes(Path path, String s, LinkOption... linkOptions) throws IOException { - return null; + if (s == null) { + throw LoggingUtility.logError(logger, new IllegalArgumentException("Attribute string cannot be null.")); + } + + Map results = new HashMap<>(); + + /* + AzureBlobFileAttributes can do everything the basic attributes can do and more. There's no need to instantiate + one of each if both are specified somewhere in the list as that will waste a network call. This can be + generified later if we need to add more attribute types, but for now we can stick to just caching the supplier + for a single attributes object. + */ + Map> attributeSuppliers = null; // Initialized later as needed. + String viewType; + String attributeList; + String[] parts = s.split(":"); + + if (parts.length > 2) { + throw LoggingUtility.logError(logger, + new IllegalArgumentException("Invalid format for attribute string: " + s)); + } + + if (parts.length == 1) { + viewType = "basic"; // Per jdk docs. + attributeList = s; + } else { + viewType = parts[0]; + attributeList = parts[1]; + } + + /* + For specificity, our basic implementation of BasicFileAttributes uses the name azureBasic. However, the docs + state that "basic" must be supported, so we funnel to azureBasic. + */ + if (viewType.equals("basic")) { + viewType = "azureBasic"; + } + if (!viewType.equals("azureBasic") && !viewType.equals("azureBlob")) { + throw LoggingUtility.logError(logger, + new UnsupportedOperationException("Invalid attribute view: " + viewType)); + } + + for (String attributeName : attributeList.split(",")) { + /* + We rely on the azureBlobFAV to actually do the work here as mentioned above, but if basic is specified, we + should at least validate that the attribute is available on a basic view. + */ + // TODO: Put these strings in constants + if (viewType.equals("azureBasic")) { + if (!AzureBasicFileAttributes.ATTRIBUTE_STRINGS.contains(attributeName) && !attributeName.equals("*")) { + throw LoggingUtility.logError(logger, + new IllegalArgumentException("Invalid attribute. View: " + viewType + + ". Attribute: " + attributeName)); + } + } + + // As mentioned, azure blob can fulfill requests to both kinds of views. + // Populate the supplier if we haven't already. + if (attributeSuppliers == null) { + attributeSuppliers = AzureBlobFileAttributes.getAttributeSuppliers( + this.readAttributes(path, AzureBlobFileAttributes.class, linkOptions)); + } + + // If "*" is specified, add all of the attributes from the specified set. + if (attributeName.equals("*")) { + Set attributesToAdd; + if (viewType.equals("azureBasic")) { + for (String attr : AzureBasicFileAttributes.ATTRIBUTE_STRINGS) { + results.put(attr, attributeSuppliers.get(attr).get()); + } + } else { + // attributeSuppliers is guaranteed to have been set by this point. + for (Map.Entry> entry: attributeSuppliers.entrySet()) { + results.put(entry.getKey(), entry.getValue().get()); + } + } + + } else if (!attributeSuppliers.containsKey(attributeName)) { + // Validate that the attribute is legal and add the value returned by the supplier to the results. + throw LoggingUtility.logError(logger, + new IllegalArgumentException("Invalid attribute. View: " + viewType + + ". Attribute: " + attributeName)); + } else { + results.put(attributeName, attributeSuppliers.get(attributeName).get()); + + } + } + + // Throw if nothing specified per jdk docs. + if (results.isEmpty()) { + throw LoggingUtility.logError(logger, + new IllegalArgumentException("No attributes were specified. Attributes: " + s)); + } + + return results; } /** + * Sets the value of a file attribute. + * + * See {@link AzureBlobFileAttributeView} for more information. + * + * Setting attributes on a virtual directory is not supported and will throw an {@link IOException}. See + * {@link #createDirectory(Path, FileAttribute[])} for more information on virtual directories. * {@inheritDoc} */ @Override public void setAttribute(Path path, String s, Object o, LinkOption... linkOptions) throws IOException { + String viewType; + String attributeName; + String[] parts = s.split(":"); + if (parts.length > 2) { + throw LoggingUtility.logError(logger, + new IllegalArgumentException("Invalid format for attribute string: " + s)); + } + if (parts.length == 1) { + viewType = "basic"; // Per jdk docs. + attributeName = s; + } else { + viewType = parts[0]; + attributeName = parts[1]; + } + + /* + For specificity, our basic implementation of BasicFileAttributes uses the name azureBasic. However, the docs + state that "basic" must be supported, so we funnel to azureBasic. + */ + if (viewType.equals("basic")) { + viewType = "azureBasic"; + } + // We don't actually support any setters on the basic view. + if (viewType.equals("azureBasic")) { + throw LoggingUtility.logError(logger, + new IllegalArgumentException("Invalid attribute. View: " + viewType + + ". Attribute: " + attributeName)); + } else if (viewType.equals("azureBlob")) { + Map> attributeConsumers = AzureBlobFileAttributeView.setAttributeConsumers( + this.getFileAttributeView(path, AzureBlobFileAttributeView.class, linkOptions)); + if (!attributeConsumers.containsKey(attributeName)) { + // Validate that the attribute is legal and add the value returned by the supplier to the results. + throw LoggingUtility.logError(logger, + new IllegalArgumentException("Invalid attribute. View: " + viewType + + ". Attribute: " + attributeName)); + } + try { + attributeConsumers.get(attributeName).accept(o); + } catch (UncheckedIOException e) { + if (e.getMessage().equals(AzureBlobFileAttributeView.ATTR_CONSUMER_ERROR)) { + throw LoggingUtility.logError(logger, e.getCause()); + } + } + } else { + throw LoggingUtility.logError(logger, + new UnsupportedOperationException("Invalid attribute view: " + viewType)); + } } void closeFileSystem(String fileSystemName) { diff --git a/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureResource.java b/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureResource.java index 2765cba8c365..e9f3595bee0d 100644 --- a/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureResource.java +++ b/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureResource.java @@ -69,7 +69,7 @@ If the parent is just the root (or null, which means the parent is implicitly th */ Path parent = this.path.getParent(); return (parent == null || parent.equals(path.getRoot())) - || new AzureResource((AzurePath) this.path.getParent()).checkDirectoryExists(); + || new AzureResource(this.path.getParent()).checkDirectoryExists(); } /** diff --git a/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureStorageFileAttributeView.java b/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureStorageFileAttributeView.java deleted file mode 100644 index 39e529884761..000000000000 --- a/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureStorageFileAttributeView.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob.nio; - -import java.nio.file.attribute.FileAttributeView; - -/** - * Provides support for properties specific to Azure Blob Storage such as tier. - * - * {@inheritDoc} - */ -public class AzureStorageFileAttributeView implements FileAttributeView { - - /** - * Returns {@code "azureStorage"} - * {@inheritDoc} - */ - @Override - public String name() { - return "azureStorage"; - } -} diff --git a/sdk/storage/azure-storage-blob-nio/src/test/java/com/azure/storage/blob/nio/AttributeViewTest.groovy b/sdk/storage/azure-storage-blob-nio/src/test/java/com/azure/storage/blob/nio/AttributeViewTest.groovy new file mode 100644 index 000000000000..1a9585a9378e --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/java/com/azure/storage/blob/nio/AttributeViewTest.groovy @@ -0,0 +1,242 @@ +package com.azure.storage.blob.nio + +import com.azure.storage.blob.BlobClient +import com.azure.storage.blob.models.AccessTier +import com.azure.storage.blob.models.BlobHttpHeaders +import spock.lang.Unroll + +import java.nio.file.attribute.FileTime +import java.security.MessageDigest + +class AttributeViewTest extends APISpec { + /* + Get attributes--All properties set + */ + BlobClient bc + AzureFileSystem fs + + def setup() { + fs = createFS(initializeConfigMap()) + cc = rootNameToContainerClient(getDefaultDir(fs)) + bc = cc.getBlobClient(generateBlobName()) + bc.upload(defaultInputStream.get(), defaultDataSize) + } + + def cleanup() { + cc.delete() + } + + def "AzureBasicFileAttributeView readAttributes"() { + setup: + def path = fs.getPath(bc.getBlobName()) + + when: + def attr = new AzureBasicFileAttributeView(path).readAttributes() + def props = bc.getProperties() + + then: + props.getBlobSize() == attr.size() + FileTime.from(props.getLastModified().toInstant()) == attr.lastModifiedTime() + FileTime.from(props.getCreationTime().toInstant()) == attr.creationTime() + attr.isRegularFile() + !attr.isDirectory() + !attr.isSymbolicLink() + !attr.isOther() + } + + def "AzureBasicFileAttributeView directory"() { + setup: + def path = fs.getPath(generateBlobName()) + putDirectoryBlob(new AzureResource(path).getBlobClient().getBlockBlobClient()) + + when: + def attr = new AzureBasicFileAttributeView(path).readAttributes() + + then: + attr.isDirectory() + !attr.isRegularFile() + !attr.isOther() + !attr.isSymbolicLink() + } + + def "AzureBlobFileAttributeView readAttributes"() { + setup: + def path = fs.getPath(bc.getBlobName()) + + when: + def attr = new AzureBlobFileAttributeView(path).readAttributes() + def suppliers = AzureBlobFileAttributes.getAttributeSuppliers(attr) + def props = bc.getProperties() + + then: + // getters + props.getBlobSize() == attr.size() + FileTime.from(props.getLastModified().toInstant()) == attr.lastModifiedTime() + FileTime.from(props.getCreationTime().toInstant()) == attr.creationTime() + attr.isRegularFile() + !attr.isDirectory() + !attr.isSymbolicLink() + !attr.isOther() + props.getETag() == attr.eTag() + props.getContentType() == attr.blobHttpHeaders().getContentType() + props.getContentMd5() == attr.blobHttpHeaders().getContentMd5() + props.getContentLanguage() == attr.blobHttpHeaders().getContentLanguage() + props.getContentEncoding() == attr.blobHttpHeaders().getContentEncoding() + props.getContentDisposition() == attr.blobHttpHeaders().getContentDisposition() + props.getCacheControl() == attr.blobHttpHeaders().getCacheControl() + props.getBlobType() == attr.blobType() + props.getCopyId() == attr.copyId() + props.getCopyStatus() == attr.copyStatus() + props.getCopySource() == attr.copySource() + props.getCopyProgress() == attr.copyProgress() + props.getCopyCompletionTime() == attr.copyCompletionTime() + props.getCopyStatusDescription() == attr.copyStatusDescription() + props.isServerEncrypted() == attr.isServerEncrypted() + props.getAccessTier() == attr.accessTier() + props.isAccessTierInferred() == attr.isAccessTierInferred() + props.getArchiveStatus() == attr.archiveStatus() + props.getAccessTierChangeTime() == attr.accessTierChangeTime() + props.getMetadata() == attr.metadata() + props.getCommittedBlockCount() == attr.committedBlockCount() + + /* + suppliers. Used in FileSystemProvider.readAttributes(String) + Unlike the consumers used for setting properties, we test these here rather than + on the FileSystemProvider because there are so many of them and it is more feasible this way rather + than having a test for each method like the consumers. + */ + props.getBlobSize() == suppliers.get("size").get() + FileTime.from(props.getLastModified().toInstant()) == suppliers.get("lastModifiedTime").get() + FileTime.from(props.getCreationTime().toInstant()) == suppliers.get("creationTime").get() + attr.isRegularFile() + !attr.isDirectory() + !attr.isSymbolicLink() + !attr.isOther() + props.getETag() == suppliers.get("eTag").get() + props.getContentType() == ((BlobHttpHeaders) suppliers.get("blobHttpHeaders").get()).getContentType() + props.getContentMd5() == ((BlobHttpHeaders) suppliers.get("blobHttpHeaders").get()).getContentMd5() + props.getContentLanguage() == ((BlobHttpHeaders) suppliers.get("blobHttpHeaders").get()).getContentLanguage() + props.getContentEncoding() == ((BlobHttpHeaders) suppliers.get("blobHttpHeaders").get()).getContentEncoding() + props.getContentDisposition() == ((BlobHttpHeaders) suppliers.get("blobHttpHeaders").get()) + .getContentDisposition() + props.getCacheControl() == ((BlobHttpHeaders) suppliers.get("blobHttpHeaders").get()).getCacheControl() + props.getBlobType() == suppliers.get("blobType").get() + props.getCopyId() == suppliers.get("copyId").get() + props.getCopyStatus() == suppliers.get("copyStatus").get() + props.getCopySource() == suppliers.get("copySource").get() + props.getCopyProgress() == suppliers.get("copyProgress").get() + props.getCopyCompletionTime() == suppliers.get("copyCompletionTime").get() + props.getCopyStatusDescription() == suppliers.get("copyStatusDescription").get() + props.isServerEncrypted() == suppliers.get("isServerEncrypted").get() + props.getAccessTier() == suppliers.get("accessTier").get() + props.isAccessTierInferred() == suppliers.get("isAccessTierInferred").get() + props.getArchiveStatus() == suppliers.get("archiveStatus").get() + props.getAccessTierChangeTime() == suppliers.get("accessTierChangeTime").get() + props.getMetadata() == suppliers.get("metadata").get() + props.getCommittedBlockCount() == suppliers.get("committedBlockCount").get() + } + + @Unroll + def "AzureBlobFileAttributeView setBlobHttpHeaders"() { + setup: + def path = fs.getPath(bc.getBlobName()) + def view = new AzureBlobFileAttributeView(path) + def headers = new BlobHttpHeaders().setCacheControl(cacheControl) + .setContentDisposition(contentDisposition) + .setContentEncoding(contentEncoding) + .setContentLanguage(contentLanguage) + .setContentMd5(contentMD5) + .setContentType(contentType) + + when: + view.setBlobHttpHeaders(headers) + def response = bc.getProperties() + + then: + response.getCacheControl() == cacheControl + response.getContentDisposition() == contentDisposition + response.getContentEncoding() == contentEncoding + response.getContentLanguage() == contentLanguage + response.getContentMd5() == contentMD5 + response.getContentType() == contentType + + where: + cacheControl | contentDisposition | contentEncoding | contentLanguage | contentMD5 | contentType + null | null | null | null | null | null + "control" | "disposition" | "encoding" | "language" | Base64.getEncoder().encode(MessageDigest.getInstance("MD5").digest(defaultData.array())) | "type" + } + + @Unroll + def "AzureBlobFileAttributeView setMetadata"() { + setup: + def path = fs.getPath(bc.getBlobName()) + def view = new AzureBlobFileAttributeView(path) + def metadata = new HashMap() + if (key1 != null && value1 != null) { + metadata.put(key1, value1) + } + if (key2 != null && value2 != null) { + metadata.put(key2, value2) + } + + when: + view.setMetadata(metadata) + + then: + bc.getProperties().getMetadata() == metadata + + where: + key1 | value1 | key2 | value2 || statusCode + null | null | null | null || 200 + "foo" | "bar" | "fizz" | "buzz" || 200 + "i0" | "a" | "i_" | "a" || 200 /* Test culture sensitive word sort */ + } + + @Unroll + def "AzureBlobFileAttributeView setTier"() { + setup: + def path = fs.getPath(bc.getBlobName()) + def view = new AzureBlobFileAttributeView(path) + + when: + view.setTier(tier) + + then: + bc.getProperties().getAccessTier() == tier + + where: + tier | _ + AccessTier.HOT | _ + AccessTier.COOL | _ + /* + We don't test archive because it takes a while to take effect, and testing these two demonstrates that the tier + is successfully being passed to the underlying client. + */ + } + + @Unroll + def "AttributeView setTimes unsupported"() { + setup: + def path = fs.getPath(bc.getBlobName()) + def blobView = new AzureBlobFileAttributeView(path) + def basicView = new AzureBasicFileAttributeView(path) + + when: + blobView.setTimes(t1, t2, t3) + + then: + thrown(UnsupportedOperationException) + + when: + basicView.setTimes(t1, t2, t3) + + then: + thrown(UnsupportedOperationException) + + where: + t1 | t2 | t3 + FileTime.fromMillis(System.currentTimeMillis()) | null | null + null | FileTime.fromMillis(System.currentTimeMillis()) | null + null | null | FileTime.fromMillis(System.currentTimeMillis()) + } +} diff --git a/sdk/storage/azure-storage-blob-nio/src/test/java/com/azure/storage/blob/nio/AzureFileStoreTest.groovy b/sdk/storage/azure-storage-blob-nio/src/test/java/com/azure/storage/blob/nio/AzureFileStoreTest.groovy index 3f72f525cf37..e663fb006f94 100644 --- a/sdk/storage/azure-storage-blob-nio/src/test/java/com/azure/storage/blob/nio/AzureFileStoreTest.groovy +++ b/sdk/storage/azure-storage-blob-nio/src/test/java/com/azure/storage/blob/nio/AzureFileStoreTest.groovy @@ -66,8 +66,8 @@ class AzureFileStoreTest extends APISpec { where: view | viewName || supports BasicFileAttributeView.class | "basic" || true - UserDefinedFileAttributeView.class | "user" || true - AzureStorageFileAttributeView.class | "azureStorage" || true + AzureBlobFileAttributeView.class | "azureBlob" || true + AzureBasicFileAttributeView.class | "azureBasic" || true PosixFileAttributeView.class | "posix" || false } diff --git a/sdk/storage/azure-storage-blob-nio/src/test/java/com/azure/storage/blob/nio/AzureFileSystemProviderTest.groovy b/sdk/storage/azure-storage-blob-nio/src/test/java/com/azure/storage/blob/nio/AzureFileSystemProviderTest.groovy index b5bff84a6160..59b5c9737b86 100644 --- a/sdk/storage/azure-storage-blob-nio/src/test/java/com/azure/storage/blob/nio/AzureFileSystemProviderTest.groovy +++ b/sdk/storage/azure-storage-blob-nio/src/test/java/com/azure/storage/blob/nio/AzureFileSystemProviderTest.groovy @@ -4,6 +4,8 @@ package com.azure.storage.blob.nio import com.azure.storage.blob.BlobClient +import com.azure.storage.blob.models.AccessTier +import com.azure.storage.blob.models.BlobHttpHeaders import com.azure.storage.blob.specialized.AppendBlobClient import com.azure.storage.blob.specialized.BlockBlobClient import spock.lang.Requires @@ -18,6 +20,10 @@ import java.nio.file.FileSystemNotFoundException import java.nio.file.NoSuchFileException import java.nio.file.StandardCopyOption import java.nio.file.StandardOpenOption +import java.nio.file.attribute.BasicFileAttributeView +import java.nio.file.attribute.BasicFileAttributes +import java.nio.file.attribute.DosFileAttributeView +import java.nio.file.attribute.DosFileAttributes import java.nio.file.attribute.FileAttribute import java.security.MessageDigest @@ -908,7 +914,8 @@ class AzureFileSystemProviderTest extends APISpec { } @Unroll - @Requires({ liveMode() }) // Because we upload in blocks + @Requires({ liveMode() }) + // Because we upload in blocks def "OutputStream file system config"() { setup: def blockSize = 50L @@ -952,6 +959,322 @@ class AzureFileSystemProviderTest extends APISpec { thrown(IOException) } + @Unroll + def "GetAttributeView"() { + setup: + def fs = createFS(config) + + expect: + // No path validation is expected for getting the view + fs.provider().getFileAttributeView(fs.getPath("path"), type).class == expected + + where: + type || expected + BasicFileAttributeView.class || AzureBasicFileAttributeView.class + AzureBasicFileAttributeView.class || AzureBasicFileAttributeView.class + AzureBlobFileAttributeView.class || AzureBlobFileAttributeView.class + } + + def "GetAttributeView fail"() { + setup: + def fs = createFS(config) + + expect: + // No path validation is expected for getting the view + fs.provider().getFileAttributeView(fs.getPath("path"), DosFileAttributeView.class) == null + } + + @Unroll + def "ReadAttributes"() { + setup: + def fs = createFS(config) + def path = fs.getPath(generateBlobName()) + def os = fs.provider().newOutputStream(path) + os.close() + + expect: + fs.provider().readAttributes(path, type).class == expected + + where: + type || expected + BasicFileAttributes.class || AzureBasicFileAttributes.class + AzureBasicFileAttributes.class || AzureBasicFileAttributes.class + AzureBlobFileAttributes.class || AzureBlobFileAttributes.class + } + + def "ReadAttributes directory"() { + setup: + def fs = createFS(config) + def path = fs.getPath(generateBlobName()) + putDirectoryBlob(new AzureResource(path).getBlobClient().getBlockBlobClient()) + + when: + fs.provider().readAttributes(path, BasicFileAttributes.class) + + then: + notThrown(IOException) + } + + def "ReadAttributes unsupported"() { + setup: + def fs = createFS(config) + + when: + fs.provider().readAttributes(fs.getPath("path"), DosFileAttributes.class) + + then: + thrown(UnsupportedOperationException) + } + + def "ReadAttributes IOException"() { + setup: + def fs = createFS(config) + + when: "Path does not exist" + // Covers virtual directory, too + fs.provider().readAttributes(fs.getPath("path"), BasicFileAttributes.class) + + then: + thrown(IOException) + } + + @Unroll + def "ReadAttributes str parsing"() { + /* + This test checks that we correctly parse the attribute string and that all the requested attributes are + represented in the return value. We can also just test a subset of attributes for parsing logic. + */ + setup: + def fs = createFS(config) + def path = fs.getPath(generateBlobName()) + def os = fs.provider().newOutputStream(path) + os.close() + + when: + def result = fs.provider().readAttributes(path, attrStr) + + then: + for (String attr : attrList) { + assert result.keySet().contains(attr) + } + result.keySet().size() == attrList.size() + + where: + attrStr || attrList + "*" || ["lastModifiedTime", "creationTime", "isRegularFile", "isDirectory", "isSymbolicLink", "isOther", "size"] + "basic:*" || ["lastModifiedTime", "creationTime", "isRegularFile", "isDirectory", "isSymbolicLink", "isOther", "size"] + "azureBasic:*" || ["lastModifiedTime", "creationTime", "isRegularFile", "isDirectory", "isSymbolicLink", "isOther", "size"] + "azureBlob:*" || ["lastModifiedTime", "creationTime", "eTag", "blobHttpHeaders", "blobType", "copyId", "copyStatus", "copySource", "copyProgress", "copyCompletionTime", "copyStatusDescription", "isServerEncrypted", "accessTier", "isAccessTierInferred", "archiveStatus", "accessTierChangeTime", "metadata", "committedBlockCount", "isRegularFile", "isDirectory", "isSymbolicLink", "isOther", "size"] + "lastModifiedTime,creationTime" || ["lastModifiedTime", "creationTime"] + "basic:isRegularFile,isDirectory" || ["isRegularFile", "isDirectory"] + "azureBasic:size" || ["size"] + "azureBlob:eTag,blobHttpHeaders,blobType,copyId" || ["eTag", "blobHttpHeaders", "blobType", "copyId"] + } + + def "ReadAttributes str suppliers"() { + // This test checks that for each requested attribute, we call the correct supplier and that the supplier maps to the correct property + } + + def "ReadAttributes str directory"() { + setup: + def fs = createFS(config) + def path = fs.getPath(generateBlobName()) + putDirectoryBlob(new AzureResource(path).getBlobClient().getBlockBlobClient()) + + when: + fs.provider().readAttributes(path, "creationTime") + + then: + notThrown(IOException) + } + + @Unroll + def "ReadAttributes str IA"() { + setup: + def fs = createFS(config) + def path = fs.getPath(generateBlobName()) + + when: + fs.provider().readAttributes(path, attrStr) + + then: + thrown(IllegalArgumentException) + + where: + attrStr | _ + "azureBlob:size:foo" | _ // Invalid format + "" | _ // empty + "azureBasic:foo" | _ // Invalid property + } + + def "ReadAttributes str invalid view"() { + setup: + def fs = createFS(config) + def path = fs.getPath(generateBlobName()) + + when: + fs.provider().readAttributes(path, "foo:size") + + then: + thrown(UnsupportedOperationException) + } + + def "ReadAttributes str IOException"() { + setup: + def fs = createFS(config) + + when: "Path does not exist" + // Covers virtual directory, too + fs.provider().readAttributes(fs.getPath("path"), "basic:creationTime") + + then: + thrown(IOException) + } + + @Unroll + def "SetAttributes headers"() { + setup: + def fs = createFS(config) + def path = fs.getPath(generateBlobName()) + def os = fs.provider().newOutputStream(path) + os.close() + + def headers = new BlobHttpHeaders().setCacheControl(cacheControl) + .setContentDisposition(contentDisposition) + .setContentEncoding(contentEncoding) + .setContentLanguage(contentLanguage) + .setContentMd5(contentMD5) + .setContentType(contentType) + + when: + fs.provider().setAttribute(path, "azureBlob:blobHttpHeaders", headers) + headers = fs.provider().readAttributes(path, AzureBlobFileAttributes.class).blobHttpHeaders() + + then: + headers.getCacheControl() == cacheControl + headers.getContentDisposition() == contentDisposition + headers.getContentEncoding() == contentEncoding + headers.getContentLanguage() == contentLanguage + headers.getContentMd5() == contentMD5 + headers.getContentType() == contentType + + where: + cacheControl | contentDisposition | contentEncoding | contentLanguage | contentMD5 | contentType + null | null | null | null | null | null + "control" | "disposition" | "encoding" | "language" | Base64.getEncoder().encode(MessageDigest.getInstance("MD5").digest(defaultData.array())) | "type" + } + + @Unroll + def "SetAttributes metadata"() { + setup: + def fs = createFS(config) + def path = fs.getPath(generateBlobName()) + def os = fs.provider().newOutputStream(path) + os.close() + + def metadata = new HashMap() + if (key1 != null && value1 != null) { + metadata.put(key1, value1) + } + if (key2 != null && value2 != null) { + metadata.put(key2, value2) + } + + when: + fs.provider().setAttribute(path, "azureBlob:metadata", metadata) + def returnedMetadata = fs.provider().readAttributes(path, AzureBlobFileAttributes.class).metadata() + + then: + metadata == returnedMetadata + + where: + key1 | value1 | key2 | value2 || statusCode + null | null | null | null || 200 + "foo" | "bar" | "fizz" | "buzz" || 200 + "i0" | "a" | "i_" | "a" || 200 /* Test culture sensitive word sort */ + } + + @Unroll + def "SetAttributes tier"() { + setup: + def fs = createFS(config) + def path = fs.getPath(generateBlobName()) + def os = fs.provider().newOutputStream(path) + os.close() + + when: + fs.provider().setAttribute(path, "azureBlob:tier", tier) + + then: + fs.provider().readAttributes(path, AzureBlobFileAttributes.class).accessTier() == tier + + where: + tier | _ + AccessTier.HOT | _ + AccessTier.COOL | _ + /* + We don't test archive because it takes a while to take effect, and testing these two demonstrates that the tier + is successfully being passed to the underlying client. + */ + } + + @Unroll + def "SetAttributes directory"() { + setup: + def fs = createFS(config) + def path = fs.getPath(generateBlobName()) + putDirectoryBlob(new AzureResource(path).getBlobClient().getBlockBlobClient()) + + when: + fs.provider().setAttribute(path, "azureBlob:tier", AccessTier.COOL) + + then: + notThrown(IOException) + } + + @Unroll + def "SetAttributes IA"() { + setup: + def fs = createFS(config) + def path = fs.getPath(generateBlobName()) + + when: + fs.provider().setAttribute(path, attrStr, "Foo") + + then: + thrown(IllegalArgumentException) + + where: + attrStr | _ + "azureBlob:metadata:foo" | _ // Invalid format + "" | _ // empty + "azureBasic:foo" | _ // Invalid property + } + + def "SetAttributes invalid view"() { + setup: + def fs = createFS(config) + def path = fs.getPath(generateBlobName()) + + when: + fs.provider().setAttribute(path, "foo:size", "foo") + + then: + thrown(UnsupportedOperationException) + } + + def "SetAttributes IOException"() { + setup: + def fs = createFS(config) + + when: "Path does not exist" + // Covers virtual directory, too + fs.provider().setAttribute(fs.getPath("path"), "azureBlob:metadata", Collections.emptyMap()) + + then: + thrown(IOException) + } + def basicSetupForCopyTest(FileSystem fs) { // Generate resource names. // Don't use default directory to ensure we honor the root. diff --git a/sdk/storage/azure-storage-blob-nio/src/test/java/com/azure/storage/blob/nio/AzureFileSystemTest.groovy b/sdk/storage/azure-storage-blob-nio/src/test/java/com/azure/storage/blob/nio/AzureFileSystemTest.groovy index 240a0b9c8306..47a8989c410a 100644 --- a/sdk/storage/azure-storage-blob-nio/src/test/java/com/azure/storage/blob/nio/AzureFileSystemTest.groovy +++ b/sdk/storage/azure-storage-blob-nio/src/test/java/com/azure/storage/blob/nio/AzureFileSystemTest.groovy @@ -216,8 +216,8 @@ class AzureFileSystemTest extends APISpec { where: view | supports "basic" | true - "user" | true - "azureStorage" | true + "azureBasic" | true + "azureBlob" | true "posix" | false } diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestattributeviewsettimesunsupported[0].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestattributeviewsettimesunsupported[0].json new file mode 100644 index 000000000000..026a41b87d22 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestattributeviewsettimesunsupported[0].json @@ -0,0 +1,174 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcattributeviewsettimesunsupported182220563339f0c97?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "94913c7d-4bfc-4fb7-b96a-efb2437152f8" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "c6bdc8d3-101e-0021-734d-4e7c2c000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:c6bdc8d3-101e-0021-734d-4e7c2c000000\nTime:2020-06-29T19:40:27.7854484Z", + "Date" : "Mon, 29 Jun 2020 19:40:26 GMT", + "x-ms-client-request-id" : "94913c7d-4bfc-4fb7-b96a-efb2437152f8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcattributeviewsettimesunsupported182220563339f0c97?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "4c8a0002-bd57-49d2-9635-df4aca195313" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C644696973B", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "5f26a1c6-a01e-0099-7f4d-4e9edf000000", + "Date" : "Mon, 29 Jun 2020 19:40:27 GMT", + "x-ms-client-request-id" : "4c8a0002-bd57-49d2-9635-df4aca195313" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcattributeviewsettimesunsupported2611461be8ff8b7b5?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "218c80bd-c89a-415e-97de-295daa14ff7c" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "7283252d-301e-0139-764d-4e17ec000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:7283252d-301e-0139-764d-4e17ec000000\nTime:2020-06-29T19:40:28.1121123Z", + "Date" : "Mon, 29 Jun 2020 19:40:28 GMT", + "x-ms-client-request-id" : "218c80bd-c89a-415e-97de-295daa14ff7c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcattributeviewsettimesunsupported2611461be8ff8b7b5?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "8dcca6f1-c90e-42f2-9d7c-62325623c741" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6446C606BD", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2a617360-901e-005d-444d-4ee119000000", + "Date" : "Mon, 29 Jun 2020 19:40:27 GMT", + "x-ms-client-request-id" : "8dcca6f1-c90e-42f2-9d7c-62325623c741" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcattributeviewsettimesunsupported182220563339f0c97/javablobattributeviewsettimesunsupported375344def9dd57", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "93d66fbb-fbd8-49fa-afd5-94819a77a380", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:40:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D81C6446E1291D", + "Content-Length" : "0", + "x-ms-request-id" : "afb91a89-801e-0049-4c4d-4e227d000000", + "x-ms-client-request-id" : "93d66fbb-fbd8-49fa-afd5-94819a77a380" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcattributeviewsettimesunsupported182220563339f0c97?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "01ce62c0-180d-4bc4-ab79-fcf5eb61a2bb" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9a325db1-601e-00ad-2d4d-4e3177000000", + "Date" : "Mon, 29 Jun 2020 19:40:27 GMT", + "x-ms-client-request-id" : "01ce62c0-180d-4bc4-ab79-fcf5eb61a2bb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcattributeviewsettimesunsupported&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "2cfefd46-11c2-4c43-bbc1-fd40465cb605" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "049b8d94-901e-00d5-754d-4e59c0000000", + "Body" : "jtcattributeviewsettimesunsupportedjtcattributeviewsettimesunsupported2611461be8ff8b7b5Mon, 29 Jun 2020 19:40:28 GMT\"0x8D81C6446C606BD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:40:28 GMT", + "x-ms-client-request-id" : "2cfefd46-11c2-4c43-bbc1-fd40465cb605", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcattributeviewsettimesunsupported2611461be8ff8b7b5?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "2e339a35-b800-4a39-8f9b-d7e8aa891c4d" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e7a623a5-501e-00ae-414d-4e3270000000", + "Date" : "Mon, 29 Jun 2020 19:40:28 GMT", + "x-ms-client-request-id" : "2e339a35-b800-4a39-8f9b-d7e8aa891c4d" + }, + "Exception" : null + } ], + "variables" : [ "jtcattributeviewsettimesunsupported079975668a30ebc99", "jtcattributeviewsettimesunsupported182220563339f0c97", "jtcattributeviewsettimesunsupported2611461be8ff8b7b5", "javablobattributeviewsettimesunsupported375344def9dd57" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestattributeviewsettimesunsupported[1].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestattributeviewsettimesunsupported[1].json new file mode 100644 index 000000000000..b6a2ebbb531c --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestattributeviewsettimesunsupported[1].json @@ -0,0 +1,174 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcattributeviewsettimesunsupported14552883c497ab8e8?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "cdd4bc2c-5e71-4c54-996f-e693b5ceca88" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "3229ad26-a01e-00d6-5e4d-4e5ac7000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:3229ad26-a01e-00d6-5e4d-4e5ac7000000\nTime:2020-06-29T19:40:29.0811724Z", + "Date" : "Mon, 29 Jun 2020 19:40:28 GMT", + "x-ms-client-request-id" : "cdd4bc2c-5e71-4c54-996f-e693b5ceca88", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcattributeviewsettimesunsupported14552883c497ab8e8?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "b92e7575-2f8a-49ef-80b6-333c9c573213" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C64475AEF03", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "710bce92-401e-00fe-764d-4e2d78000000", + "Date" : "Mon, 29 Jun 2020 19:40:28 GMT", + "x-ms-client-request-id" : "b92e7575-2f8a-49ef-80b6-333c9c573213" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcattributeviewsettimesunsupported245336fb55c1265d4?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "92800901-7e2c-4d46-8264-73e9154d28ba" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "d25f422c-201e-0126-524d-4eccfc000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:d25f422c-201e-0126-524d-4eccfc000000\nTime:2020-06-29T19:40:29.3947049Z", + "Date" : "Mon, 29 Jun 2020 19:40:29 GMT", + "x-ms-client-request-id" : "92800901-7e2c-4d46-8264-73e9154d28ba", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcattributeviewsettimesunsupported245336fb55c1265d4?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "71bf5119-f9b5-4a6a-87da-2f011e80b66f" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C644789FF84", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7ed25047-501e-00ea-1d4d-4eee1c000000", + "Date" : "Mon, 29 Jun 2020 19:40:29 GMT", + "x-ms-client-request-id" : "71bf5119-f9b5-4a6a-87da-2f011e80b66f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcattributeviewsettimesunsupported14552883c497ab8e8/javablobattributeviewsettimesunsupported3853882130875c", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "17479d21-c9fe-4b8d-ba64-ff3666f39d82", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:40:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D81C6447A348FF", + "Content-Length" : "0", + "x-ms-request-id" : "31a7b760-301e-0072-744d-4e6023000000", + "x-ms-client-request-id" : "17479d21-c9fe-4b8d-ba64-ff3666f39d82" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcattributeviewsettimesunsupported14552883c497ab8e8?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "8071a635-00af-45cd-afe4-3bcf29b19971" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b5855797-301e-0036-6c4d-4ebc4f000000", + "Date" : "Mon, 29 Jun 2020 19:40:29 GMT", + "x-ms-client-request-id" : "8071a635-00af-45cd-afe4-3bcf29b19971" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcattributeviewsettimesunsupported&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "af95118a-4293-40d8-aaa6-8824e6bf87d7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "08a64c77-c01e-0023-434d-4e7ed6000000", + "Body" : "jtcattributeviewsettimesunsupportedjtcattributeviewsettimesunsupported245336fb55c1265d4Mon, 29 Jun 2020 19:40:29 GMT\"0x8D81C644789FF84\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:40:29 GMT", + "x-ms-client-request-id" : "af95118a-4293-40d8-aaa6-8824e6bf87d7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcattributeviewsettimesunsupported245336fb55c1265d4?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "e1b87339-e041-4cfc-bda3-96e0e0728a66" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8caabc8d-001e-0113-604d-4e62a9000000", + "Date" : "Mon, 29 Jun 2020 19:40:29 GMT", + "x-ms-client-request-id" : "e1b87339-e041-4cfc-bda3-96e0e0728a66" + }, + "Exception" : null + } ], + "variables" : [ "jtcattributeviewsettimesunsupported01048582f6426c77c", "jtcattributeviewsettimesunsupported14552883c497ab8e8", "jtcattributeviewsettimesunsupported245336fb55c1265d4", "javablobattributeviewsettimesunsupported3853882130875c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestattributeviewsettimesunsupported[2].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestattributeviewsettimesunsupported[2].json new file mode 100644 index 000000000000..c2b155703880 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestattributeviewsettimesunsupported[2].json @@ -0,0 +1,174 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcattributeviewsettimesunsupported1918315ba4854eae8?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "94ce2105-02f0-4225-a192-277f3b463320" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "42de7f0f-a01e-00ff-6c4d-4e2c85000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:42de7f0f-a01e-00ff-6c4d-4e2c85000000\nTime:2020-06-29T19:40:30.3299951Z", + "Date" : "Mon, 29 Jun 2020 19:40:29 GMT", + "x-ms-client-request-id" : "94ce2105-02f0-4225-a192-277f3b463320", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcattributeviewsettimesunsupported1918315ba4854eae8?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "e1ee4f21-682f-4df9-8987-f057e5d5b634" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6448198436", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42081801-b01e-00eb-6d4d-4eefe1000000", + "Date" : "Mon, 29 Jun 2020 19:40:30 GMT", + "x-ms-client-request-id" : "e1ee4f21-682f-4df9-8987-f057e5d5b634" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcattributeviewsettimesunsupported219906ff460d82fa1?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "323beff7-7926-483f-8fe7-550351b2afef" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "fc1b5207-c01e-0127-3a4d-4ecd01000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:fc1b5207-c01e-0127-3a4d-4ecd01000000\nTime:2020-06-29T19:40:30.6450381Z", + "Date" : "Mon, 29 Jun 2020 19:40:30 GMT", + "x-ms-client-request-id" : "323beff7-7926-483f-8fe7-550351b2afef", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcattributeviewsettimesunsupported219906ff460d82fa1?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "b0bb0127-da22-4383-bc6f-4f1c24d38f5f" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6448496189", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2ef205ed-501e-004b-804d-4e2087000000", + "Date" : "Mon, 29 Jun 2020 19:40:29 GMT", + "x-ms-client-request-id" : "b0bb0127-da22-4383-bc6f-4f1c24d38f5f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcattributeviewsettimesunsupported1918315ba4854eae8/javablobattributeviewsettimesunsupported3451209825b621", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "4b39077d-521d-4f37-818c-c1fc9ed8a8d9", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:40:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D81C644860FAF6", + "Content-Length" : "0", + "x-ms-request-id" : "51e792ef-401e-00d7-6a4d-4e5b3a000000", + "x-ms-client-request-id" : "4b39077d-521d-4f37-818c-c1fc9ed8a8d9" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcattributeviewsettimesunsupported1918315ba4854eae8?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "5e8492b7-86f9-4a86-bcb2-dfb5fc5a9a9b" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "4452b5f2-801e-0060-7e4d-4e543f000000", + "Date" : "Mon, 29 Jun 2020 19:40:30 GMT", + "x-ms-client-request-id" : "5e8492b7-86f9-4a86-bcb2-dfb5fc5a9a9b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcattributeviewsettimesunsupported&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "10dd49ef-197d-4ee9-b22b-c331dc7f3781" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b666b786-401e-0114-5b4d-4e942c000000", + "Body" : "jtcattributeviewsettimesunsupportedjtcattributeviewsettimesunsupported219906ff460d82fa1Mon, 29 Jun 2020 19:40:30 GMT\"0x8D81C6448496189\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:40:30 GMT", + "x-ms-client-request-id" : "10dd49ef-197d-4ee9-b22b-c331dc7f3781", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcattributeviewsettimesunsupported219906ff460d82fa1?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "6d5f23c9-3966-4685-9dbd-08613c56e157" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b2612e00-a01e-0038-1b4d-4e5044000000", + "Date" : "Mon, 29 Jun 2020 19:40:30 GMT", + "x-ms-client-request-id" : "6d5f23c9-3966-4685-9dbd-08613c56e157" + }, + "Exception" : null + } ], + "variables" : [ "jtcattributeviewsettimesunsupported063342d335c29a208", "jtcattributeviewsettimesunsupported1918315ba4854eae8", "jtcattributeviewsettimesunsupported219906ff460d82fa1", "javablobattributeviewsettimesunsupported3451209825b621" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazurebasicfileattributeviewdirectory.json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazurebasicfileattributeviewdirectory.json new file mode 100644 index 000000000000..8b03d8be495e --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazurebasicfileattributeviewdirectory.json @@ -0,0 +1,227 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazurebasicfileattributeviewdirectory1170332acf31a01?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "1344815c-bd40-42e6-8919-ac8cb3b2b983" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "4452a17b-801e-0060-194d-4e543f000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:4452a17b-801e-0060-194d-4e543f000000\nTime:2020-06-29T19:40:13.0863570Z", + "Date" : "Mon, 29 Jun 2020 19:40:12 GMT", + "x-ms-client-request-id" : "1344815c-bd40-42e6-8919-ac8cb3b2b983", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazurebasicfileattributeviewdirectory1170332acf31a01?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "3c75c65e-c8e8-4567-8d3d-6964bb0a5eea" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C643DD28058", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b666a53f-401e-0114-354d-4e942c000000", + "Date" : "Mon, 29 Jun 2020 19:40:12 GMT", + "x-ms-client-request-id" : "3c75c65e-c8e8-4567-8d3d-6964bb0a5eea" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazurebasicfileattributeviewdirectory216007edc121e8c?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "bffebd04-40c6-44f4-b044-087553763cb1" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "5c8dae17-301e-00d8-584d-4eb6cc000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:5c8dae17-301e-00d8-584d-4eb6cc000000\nTime:2020-06-29T19:40:13.4173191Z", + "Date" : "Mon, 29 Jun 2020 19:40:12 GMT", + "x-ms-client-request-id" : "bffebd04-40c6-44f4-b044-087553763cb1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazurebasicfileattributeviewdirectory216007edc121e8c?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "4255d165-da07-49a7-b350-f7249f669535" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C643E045D1A", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f3953ab5-501e-0100-214d-4e5748000000", + "Date" : "Mon, 29 Jun 2020 19:40:13 GMT", + "x-ms-client-request-id" : "4255d165-da07-49a7-b350-f7249f669535" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazurebasicfileattributeviewdirectory1170332acf31a01/javablobazurebasicfileattributeviewdirectory396544396ecf", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "daa2201d-9c0b-4b7c-a8aa-b58026cc85a0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:40:13 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D81C643E1E1D93", + "Content-Length" : "0", + "x-ms-request-id" : "3045bc6f-a01e-00b0-5d4d-4ee89d000000", + "x-ms-client-request-id" : "daa2201d-9c0b-4b7c-a8aa-b58026cc85a0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazurebasicfileattributeviewdirectory1170332acf31a01/javablobazurebasicfileattributeviewdirectory4662394d9819?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "83c73663-d769-48a6-8e04-2108abf7bd5e", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C643E47CFD5", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "3c3d4973-901e-0074-134d-4e975b000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:40:13 GMT", + "x-ms-client-request-id" : "83c73663-d769-48a6-8e04-2108abf7bd5e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazurebasicfileattributeviewdirectory1170332acf31a01/javablobazurebasicfileattributeviewdirectory4662394d9819", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "5b7fa9cc-2df3-4796-a2c7-8fd3631de097" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:14 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:40:14 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-meta-hdi_isfolder" : "true", + "ETag" : "0x8D81C643E47CFD5", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:40:14 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "2c5c19bf-301e-009c-6e4d-4e6aa0000000", + "x-ms-client-request-id" : "5b7fa9cc-2df3-4796-a2c7-8fd3631de097", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazurebasicfileattributeviewdirectory1170332acf31a01?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "f7d65cc2-5f18-4ea2-aa8f-cb9cbed55df8" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c100957d-601e-0061-1b4d-4e55c2000000", + "Date" : "Mon, 29 Jun 2020 19:40:14 GMT", + "x-ms-client-request-id" : "f7d65cc2-5f18-4ea2-aa8f-cb9cbed55df8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcazurebasicfileattributeviewdirectory&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "44d1e0cc-f68f-4732-ba33-814c65c6c655" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d120d4f8-f01e-004d-3d4d-4ed7ff000000", + "Body" : "jtcazurebasicfileattributeviewdirectoryjtcazurebasicfileattributeviewdirectory216007edc121e8cMon, 29 Jun 2020 19:40:13 GMT\"0x8D81C643E045D1A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:40:14 GMT", + "x-ms-client-request-id" : "44d1e0cc-f68f-4732-ba33-814c65c6c655", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazurebasicfileattributeviewdirectory216007edc121e8c?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "7aa503f2-7b6f-4094-9f17-a64508848a86" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ebc2c3bb-601e-0025-514d-4e89ae000000", + "Date" : "Mon, 29 Jun 2020 19:40:13 GMT", + "x-ms-client-request-id" : "7aa503f2-7b6f-4094-9f17-a64508848a86" + }, + "Exception" : null + } ], + "variables" : [ "jtcazurebasicfileattributeviewdirectory034138295640901", "jtcazurebasicfileattributeviewdirectory1170332acf31a01", "jtcazurebasicfileattributeviewdirectory216007edc121e8c", "javablobazurebasicfileattributeviewdirectory396544396ecf", "javablobazurebasicfileattributeviewdirectory4662394d9819" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazurebasicfileattributeviewreadattributes.json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazurebasicfileattributeviewreadattributes.json new file mode 100644 index 000000000000..7a8a2d6e0fff --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazurebasicfileattributeviewreadattributes.json @@ -0,0 +1,232 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazurebasicfileattributeviewreadattributes174994735ae2?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "45cfd00b-89cd-4f42-967b-893127970377" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "5419cb85-b01e-004a-274d-4e217a000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:5419cb85-b01e-004a-274d-4e217a000000\nTime:2020-06-29T19:40:10.7235703Z", + "Date" : "Mon, 29 Jun 2020 19:40:10 GMT", + "x-ms-client-request-id" : "45cfd00b-89cd-4f42-967b-893127970377", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazurebasicfileattributeviewreadattributes174994735ae2?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "d4f59bd3-9faf-4995-b52c-bd010f250771" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C643C8747D5", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "82b842e4-201e-0022-334d-4e7f2b000000", + "Date" : "Mon, 29 Jun 2020 19:40:10 GMT", + "x-ms-client-request-id" : "d4f59bd3-9faf-4995-b52c-bd010f250771" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazurebasicfileattributeviewreadattributes2108029f7818?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "63efcae4-3acc-4077-a4e0-5e14ccb44f51" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "4d48d4bd-001e-013a-6e4d-4e14eb000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:4d48d4bd-001e-013a-6e4d-4e14eb000000\nTime:2020-06-29T19:40:11.3561050Z", + "Date" : "Mon, 29 Jun 2020 19:40:10 GMT", + "x-ms-client-request-id" : "63efcae4-3acc-4077-a4e0-5e14ccb44f51", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazurebasicfileattributeviewreadattributes2108029f7818?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "4ca37f69-0d00-4e09-9da2-3615acd35dc1" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C643CCCCD8B", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7f7cfa70-501e-000f-254d-4efceb000000", + "Date" : "Mon, 29 Jun 2020 19:40:10 GMT", + "x-ms-client-request-id" : "4ca37f69-0d00-4e09-9da2-3615acd35dc1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazurebasicfileattributeviewreadattributes174994735ae2/javablobazurebasicfileattributeviewreadattributes3272520ff4", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "47db7edd-3cf1-4843-aef2-8867c8481457", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:40:11 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D81C643CFD4BD8", + "Content-Length" : "0", + "x-ms-request-id" : "1c32a990-d01e-0037-6c4d-4ebdb2000000", + "x-ms-client-request-id" : "47db7edd-3cf1-4843-aef2-8867c8481457" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazurebasicfileattributeviewreadattributes174994735ae2/javablobazurebasicfileattributeviewreadattributes3272520ff4", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "39a606d8-5061-4bbb-8d23-dde0716a15cc" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:11 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:40:11 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "0x8D81C643CFD4BD8", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:40:11 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "22f49021-b01e-00af-114d-4e338d000000", + "x-ms-client-request-id" : "39a606d8-5061-4bbb-8d23-dde0716a15cc", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazurebasicfileattributeviewreadattributes174994735ae2/javablobazurebasicfileattributeviewreadattributes3272520ff4", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "fbbc30b2-f7cd-47b9-885e-99da801a9ed8" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:11 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:40:11 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "0x8D81C643CFD4BD8", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:40:11 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "fa751f89-501e-0087-224d-4e4432000000", + "x-ms-client-request-id" : "fbbc30b2-f7cd-47b9-885e-99da801a9ed8", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazurebasicfileattributeviewreadattributes174994735ae2?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "acd09338-0fe3-47f5-ba7e-654bbeecb557" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "282ecac9-701e-009b-404d-4e9c25000000", + "Date" : "Mon, 29 Jun 2020 19:40:12 GMT", + "x-ms-client-request-id" : "acd09338-0fe3-47f5-ba7e-654bbeecb557" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcazurebasicfileattributeviewreadattributes&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "6a3b2fc5-41a1-417b-b9d3-9fa95bbe6627" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "88fed40f-d01e-0073-074d-4e61de000000", + "Body" : "jtcazurebasicfileattributeviewreadattributesjtcazurebasicfileattributeviewreadattributes2108029f7818Mon, 29 Jun 2020 19:40:11 GMT\"0x8D81C643CCCCD8B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:40:12 GMT", + "x-ms-client-request-id" : "6a3b2fc5-41a1-417b-b9d3-9fa95bbe6627", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazurebasicfileattributeviewreadattributes2108029f7818?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "a8aa9f5c-3dac-4102-9122-2568936eb983" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "51e78253-401e-00d7-2a4d-4e5b3a000000", + "Date" : "Mon, 29 Jun 2020 19:40:12 GMT", + "x-ms-client-request-id" : "a8aa9f5c-3dac-4102-9122-2568936eb983" + }, + "Exception" : null + } ], + "variables" : [ "jtcazurebasicfileattributeviewreadattributes0420973d59a6", "jtcazurebasicfileattributeviewreadattributes174994735ae2", "jtcazurebasicfileattributeviewreadattributes2108029f7818", "javablobazurebasicfileattributeviewreadattributes3272520ff4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazureblobfileattributeviewreadattributes.json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazureblobfileattributeviewreadattributes.json new file mode 100644 index 000000000000..ac30b8471f59 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazureblobfileattributeviewreadattributes.json @@ -0,0 +1,232 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewreadattributes1243094876f1f?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "29099c34-24d6-46fc-935b-63cdc4b92b21" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "2c7ae6a4-101e-00ed-264d-4e1899000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:2c7ae6a4-101e-00ed-264d-4e1899000000\nTime:2020-06-29T19:40:14.8715676Z", + "Date" : "Mon, 29 Jun 2020 19:40:13 GMT", + "x-ms-client-request-id" : "29099c34-24d6-46fc-935b-63cdc4b92b21", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewreadattributes1243094876f1f?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "f38a24e7-53ac-487e-a093-a35a811af4aa" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C643EE173E1", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "a3c1b6f0-f01e-00c5-1f4d-4e6f26000000", + "Date" : "Mon, 29 Jun 2020 19:40:14 GMT", + "x-ms-client-request-id" : "f38a24e7-53ac-487e-a093-a35a811af4aa" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewreadattributes255884ba4a1c7?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "44423c81-a6bc-4c4b-b455-bd95f3b17413" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "ee81ec04-c01e-0089-0b4d-4ea839000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:ee81ec04-c01e-0089-0b4d-4ea839000000\nTime:2020-06-29T19:40:15.1848518Z", + "Date" : "Mon, 29 Jun 2020 19:40:14 GMT", + "x-ms-client-request-id" : "44423c81-a6bc-4c4b-b455-bd95f3b17413", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewreadattributes255884ba4a1c7?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "eb8aad86-979f-4c22-a38f-a9aaa962da98" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C643F129B24", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ea7b241e-501e-0129-314d-4e210a000000", + "Date" : "Mon, 29 Jun 2020 19:40:14 GMT", + "x-ms-client-request-id" : "eb8aad86-979f-4c22-a38f-a9aaa962da98" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewreadattributes1243094876f1f/javablobazureblobfileattributeviewreadattributes398226f241", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "5706def7-1fee-41ab-9c4e-1c740dc333bd", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:40:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D81C643F2AC62A", + "Content-Length" : "0", + "x-ms-request-id" : "58de2568-b01e-0101-3b4d-4e56b5000000", + "x-ms-client-request-id" : "5706def7-1fee-41ab-9c4e-1c740dc333bd" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewreadattributes1243094876f1f/javablobazureblobfileattributeviewreadattributes398226f241", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "e9f12b6d-7e3b-4981-be53-be6db6f73685" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:15 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:40:15 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "0x8D81C643F2AC62A", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:40:15 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "59a07e6c-701e-00b2-714d-4eea67000000", + "x-ms-client-request-id" : "e9f12b6d-7e3b-4981-be53-be6db6f73685", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewreadattributes1243094876f1f/javablobazureblobfileattributeviewreadattributes398226f241", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "b5701efe-8eed-4168-af1a-41cdd767d4f2" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:15 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:40:15 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "0x8D81C643F2AC62A", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:40:15 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "02d9fdbe-601e-012a-5a4d-4e220d000000", + "x-ms-client-request-id" : "b5701efe-8eed-4168-af1a-41cdd767d4f2", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewreadattributes1243094876f1f?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "3c457e69-a16a-4f31-9290-18b29acf898a" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "586b1431-201e-00ee-6e4d-4e1b9e000000", + "Date" : "Mon, 29 Jun 2020 19:40:16 GMT", + "x-ms-client-request-id" : "3c457e69-a16a-4f31-9290-18b29acf898a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcazureblobfileattributeviewreadattributes&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "feadc28e-f27b-4e13-a7f2-3713c3f55b0c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "091ab25c-e01e-009e-3c4d-4e685a000000", + "Body" : "jtcazureblobfileattributeviewreadattributesjtcazureblobfileattributeviewreadattributes255884ba4a1c7Mon, 29 Jun 2020 19:40:15 GMT\"0x8D81C643F129B24\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:40:15 GMT", + "x-ms-client-request-id" : "feadc28e-f27b-4e13-a7f2-3713c3f55b0c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewreadattributes255884ba4a1c7?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "0a40e61d-cfdf-46ca-a905-32c04b8412c1" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "fb0b2a83-401e-0076-6c4d-4e95a1000000", + "Date" : "Mon, 29 Jun 2020 19:40:16 GMT", + "x-ms-client-request-id" : "0a40e61d-cfdf-46ca-a905-32c04b8412c1" + }, + "Exception" : null + } ], + "variables" : [ "jtcazureblobfileattributeviewreadattributes081383f279b1f", "jtcazureblobfileattributeviewreadattributes1243094876f1f", "jtcazureblobfileattributeviewreadattributes255884ba4a1c7", "javablobazureblobfileattributeviewreadattributes398226f241" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazureblobfileattributeviewsetblobhttpheaders[0].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazureblobfileattributeviewsetblobhttpheaders[0].json new file mode 100644 index 000000000000..bfc974a7d528 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazureblobfileattributeviewsetblobhttpheaders[0].json @@ -0,0 +1,222 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetblobhttpheaders1208245463c?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "778cba62-6da2-4c4b-ab7c-ac45105d7aa4" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "eabb4691-201e-00c7-0e4d-4e6ddc000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:eabb4691-201e-00c7-0e4d-4e6ddc000000\nTime:2020-06-29T19:40:16.5947228Z", + "Date" : "Mon, 29 Jun 2020 19:40:16 GMT", + "x-ms-client-request-id" : "778cba62-6da2-4c4b-ab7c-ac45105d7aa4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetblobhttpheaders1208245463c?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "bb4d24b2-f5d4-4cf7-a0ed-9ce03b874009" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C643FED6C83", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c3db590e-601e-0103-5a4d-4e544f000000", + "Date" : "Mon, 29 Jun 2020 19:40:16 GMT", + "x-ms-client-request-id" : "bb4d24b2-f5d4-4cf7-a0ed-9ce03b874009" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetblobhttpheaders284195a5240?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "91a6a220-a1dd-40bf-9190-90726375e4b4" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "58dd7bd5-701e-0117-2d4d-4e972b000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:58dd7bd5-701e-0117-2d4d-4e972b000000\nTime:2020-06-29T19:40:16.9329910Z", + "Date" : "Mon, 29 Jun 2020 19:40:16 GMT", + "x-ms-client-request-id" : "91a6a220-a1dd-40bf-9190-90726375e4b4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetblobhttpheaders284195a5240?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "4f8b54bc-d5f2-4cbf-9a4f-c732a4745feb" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C64401E2D27", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9cc51f14-b01e-0063-124d-4e5738000000", + "Date" : "Mon, 29 Jun 2020 19:40:16 GMT", + "x-ms-client-request-id" : "4f8b54bc-d5f2-4cbf-9a4f-c732a4745feb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetblobhttpheaders1208245463c/javablobazureblobfileattributeviewsetblobhttpheaders398918a3", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "9920fd45-f931-4b5a-8e61-6da030c2f191", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:40:16 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D81C644035C09D", + "Content-Length" : "0", + "x-ms-request-id" : "d5c0f134-901e-00b3-104d-4eeb9a000000", + "x-ms-client-request-id" : "9920fd45-f931-4b5a-8e61-6da030c2f191" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetblobhttpheaders1208245463c/javablobazureblobfileattributeviewsetblobhttpheaders398918a3?comp=properties", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "a7ee9956-daab-42f3-9c7c-bed3a8dd4936" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C64405165B4", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "53b613d6-b01e-0027-344d-4e8b54000000", + "Date" : "Mon, 29 Jun 2020 19:40:16 GMT", + "x-ms-client-request-id" : "a7ee9956-daab-42f3-9c7c-bed3a8dd4936" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetblobhttpheaders1208245463c/javablobazureblobfileattributeviewsetblobhttpheaders398918a3", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "d0136141-9179-448e-96a9-f4b76a440a45" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:17 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:40:17 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "0x8D81C64405165B4", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:40:17 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "86e4a555-a01e-0077-3a4d-4e945c000000", + "x-ms-client-request-id" : "d0136141-9179-448e-96a9-f4b76a440a45" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetblobhttpheaders1208245463c?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "0d865608-dc39-4e35-976d-187e0a051cc5" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "03b07963-d01e-0078-674d-4e79aa000000", + "Date" : "Mon, 29 Jun 2020 19:40:17 GMT", + "x-ms-client-request-id" : "0d865608-dc39-4e35-976d-187e0a051cc5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcazureblobfileattributeviewsetblobhttpheaders&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "76038228-59a8-4809-91f9-a027c0bb4736" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "51ce339b-c01e-012c-6d4d-4ed575000000", + "Body" : "jtcazureblobfileattributeviewsetblobhttpheadersjtcazureblobfileattributeviewsetblobhttpheaders284195a5240Mon, 29 Jun 2020 19:40:17 GMT\"0x8D81C64401E2D27\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:40:17 GMT", + "x-ms-client-request-id" : "76038228-59a8-4809-91f9-a027c0bb4736", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetblobhttpheaders284195a5240?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "13fc397f-e6bc-4bd8-b7e0-acfb19a2ff58" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "913d5855-501e-00c8-224d-4e802a000000", + "Date" : "Mon, 29 Jun 2020 19:40:17 GMT", + "x-ms-client-request-id" : "13fc397f-e6bc-4bd8-b7e0-acfb19a2ff58" + }, + "Exception" : null + } ], + "variables" : [ "jtcazureblobfileattributeviewsetblobhttpheaders039696ec4c9", "jtcazureblobfileattributeviewsetblobhttpheaders1208245463c", "jtcazureblobfileattributeviewsetblobhttpheaders284195a5240", "javablobazureblobfileattributeviewsetblobhttpheaders398918a3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazureblobfileattributeviewsetblobhttpheaders[1].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazureblobfileattributeviewsetblobhttpheaders[1].json new file mode 100644 index 000000000000..577879f5b0e0 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazureblobfileattributeviewsetblobhttpheaders[1].json @@ -0,0 +1,228 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetblobhttpheaders1907764599f?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "a44e08a6-5a3f-4504-b739-ba0e91b37266" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "1e49c71e-c01e-00a0-534d-4ede7b000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:1e49c71e-c01e-00a0-534d-4ede7b000000\nTime:2020-06-29T19:40:18.2643838Z", + "Date" : "Mon, 29 Jun 2020 19:40:17 GMT", + "x-ms-client-request-id" : "a44e08a6-5a3f-4504-b739-ba0e91b37266", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetblobhttpheaders1907764599f?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "1b27b2a3-f051-4dd3-be4e-b468aeeb7cbb" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6440E8F9B4", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d8b45a-301e-0014-014d-4ed279000000", + "Date" : "Mon, 29 Jun 2020 19:40:17 GMT", + "x-ms-client-request-id" : "1b27b2a3-f051-4dd3-be4e-b468aeeb7cbb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetblobhttpheaders2516891726a?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "77fcf6d3-79c0-4358-ba87-da541cd8edd1" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "82e714e2-f01e-0064-3c4d-4ea1bd000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:82e714e2-f01e-0064-3c4d-4ea1bd000000\nTime:2020-06-29T19:40:18.6100852Z", + "Date" : "Mon, 29 Jun 2020 19:40:17 GMT", + "x-ms-client-request-id" : "77fcf6d3-79c0-4358-ba87-da541cd8edd1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetblobhttpheaders2516891726a?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "4cb3648f-57bc-4c0a-9bdb-3f5b31b634ba" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C64411DC5FA", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8e31e70a-c01e-0028-6c4d-4e66a2000000", + "Date" : "Mon, 29 Jun 2020 19:40:18 GMT", + "x-ms-client-request-id" : "4cb3648f-57bc-4c0a-9bdb-3f5b31b634ba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetblobhttpheaders1907764599f/javablobazureblobfileattributeviewsetblobhttpheaders305001ad", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "1127283f-5ab4-49f5-a044-1924d9d3a53f", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:40:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D81C64413609DE", + "Content-Length" : "0", + "x-ms-request-id" : "a6c0b9d6-201e-0000-5e4d-4e111d000000", + "x-ms-client-request-id" : "1127283f-5ab4-49f5-a044-1924d9d3a53f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetblobhttpheaders1907764599f/javablobazureblobfileattributeviewsetblobhttpheaders305001ad?comp=properties", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "3fff9b6f-b32a-40a9-bdeb-e3120259bb82" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C64414E0486", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "307a6246-101e-0065-154d-4ea040000000", + "Date" : "Mon, 29 Jun 2020 19:40:18 GMT", + "x-ms-client-request-id" : "3fff9b6f-b32a-40a9-bdeb-e3120259bb82" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetblobhttpheaders1907764599f/javablobazureblobfileattributeviewsetblobhttpheaders305001ad", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "a94200ec-b8f0-4458-b12c-ed4f705cb5b9" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:19 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:40:19 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "d2grV20xOEQwejFENEUrUEUyNTJnZz09", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "control", + "ETag" : "0x8D81C64414E0486", + "Content-Disposition" : "disposition", + "Content-Encoding" : "encoding", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:40:18 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "30042751-d01e-0051-0e4d-4e0fe8000000", + "x-ms-client-request-id" : "a94200ec-b8f0-4458-b12c-ed4f705cb5b9", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetblobhttpheaders1907764599f?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "1675a793-63f2-436f-86fd-5e3dd5f029a1" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0efd6387-301e-003d-6c4d-4ea43b000000", + "Date" : "Mon, 29 Jun 2020 19:40:19 GMT", + "x-ms-client-request-id" : "1675a793-63f2-436f-86fd-5e3dd5f029a1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcazureblobfileattributeviewsetblobhttpheaders&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "47d5c593-273b-4766-aec4-44b21627ef56" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2c71cf8b-d01e-0015-554d-4ed384000000", + "Body" : "jtcazureblobfileattributeviewsetblobhttpheadersjtcazureblobfileattributeviewsetblobhttpheaders2516891726aMon, 29 Jun 2020 19:40:18 GMT\"0x8D81C64411DC5FA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:40:19 GMT", + "x-ms-client-request-id" : "47d5c593-273b-4766-aec4-44b21627ef56", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetblobhttpheaders2516891726a?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "ff8f6892-318a-4b40-8884-250f0aa97dfb" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "adbffc80-b01e-008d-724d-4e5dbb000000", + "Date" : "Mon, 29 Jun 2020 19:40:19 GMT", + "x-ms-client-request-id" : "ff8f6892-318a-4b40-8884-250f0aa97dfb" + }, + "Exception" : null + } ], + "variables" : [ "jtcazureblobfileattributeviewsetblobhttpheaders09257322d37", "jtcazureblobfileattributeviewsetblobhttpheaders1907764599f", "jtcazureblobfileattributeviewsetblobhttpheaders2516891726a", "javablobazureblobfileattributeviewsetblobhttpheaders305001ad" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazureblobfileattributeviewsetmetadata[0].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazureblobfileattributeviewsetmetadata[0].json new file mode 100644 index 000000000000..5f298938eb88 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazureblobfileattributeviewsetmetadata[0].json @@ -0,0 +1,225 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata1287156eea4813?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "70fc84cf-e086-4aa7-b71d-a021d2634eca" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "9c5d4d2a-e01e-0119-074d-4e7b20000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:9c5d4d2a-e01e-0119-074d-4e7b20000000\nTime:2020-06-29T19:40:19.9080338Z", + "Date" : "Mon, 29 Jun 2020 19:40:19 GMT", + "x-ms-client-request-id" : "70fc84cf-e086-4aa7-b71d-a021d2634eca", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata1287156eea4813?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "cea179a2-d4a3-43b3-872d-ecc344a65bb1" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6441E35194", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "20195493-001e-003e-214d-4ea73c000000", + "Date" : "Mon, 29 Jun 2020 19:40:19 GMT", + "x-ms-client-request-id" : "cea179a2-d4a3-43b3-872d-ecc344a65bb1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata279163fca7e9da?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "31e18bf9-9111-4625-a3d1-81844f6d8252" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "42e8f18a-901e-00de-3d4d-4e41b4000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:42e8f18a-901e-00de-3d4d-4e41b4000000\nTime:2020-06-29T19:40:20.2172939Z", + "Date" : "Mon, 29 Jun 2020 19:40:19 GMT", + "x-ms-client-request-id" : "31e18bf9-9111-4625-a3d1-81844f6d8252", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata279163fca7e9da?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "821c3d5e-70ec-4781-9529-937fa883ca5c" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C644212184A", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "986cc358-d01e-011a-604d-4e7827000000", + "Date" : "Mon, 29 Jun 2020 19:40:19 GMT", + "x-ms-client-request-id" : "821c3d5e-70ec-4781-9529-937fa883ca5c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata1287156eea4813/javablobazureblobfileattributeviewsetmetadata3305536d3f34", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "4b86e03a-3fa9-4d1c-af68-190ac9961e63", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:40:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D81C64422A426C", + "Content-Length" : "0", + "x-ms-request-id" : "59d9eb68-101e-002a-0a4d-4e6458000000", + "x-ms-client-request-id" : "4b86e03a-3fa9-4d1c-af68-190ac9961e63" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata1287156eea4813/javablobazureblobfileattributeviewsetmetadata3305536d3f34?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "f7082177-0d92-448b-b2b2-bdf2b871e39b" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6442457239", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9148b119-001e-00b6-494d-4e1fe5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:40:20 GMT", + "x-ms-client-request-id" : "f7082177-0d92-448b-b2b2-bdf2b871e39b" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata1287156eea4813/javablobazureblobfileattributeviewsetmetadata3305536d3f34", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "2a9c4dd5-b1f5-4bb5-b291-a29fb6f2896d" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:20 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:40:20 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "0x8D81C6442457239", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:40:20 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "e4abeef3-801e-00ca-464d-4e82d0000000", + "x-ms-client-request-id" : "2a9c4dd5-b1f5-4bb5-b291-a29fb6f2896d", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata1287156eea4813?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "894b6be7-ee03-4422-a8cd-3d53f9d7bb7c" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "2988c8f8-f01e-0002-184d-4e13e7000000", + "Date" : "Mon, 29 Jun 2020 19:40:20 GMT", + "x-ms-client-request-id" : "894b6be7-ee03-4422-a8cd-3d53f9d7bb7c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcazureblobfileattributeviewsetmetadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "f22db0d1-0a67-4b63-bae2-6e7810f46a25" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e1d980e7-001e-00f2-584d-4ec389000000", + "Body" : "jtcazureblobfileattributeviewsetmetadatajtcazureblobfileattributeviewsetmetadata279163fca7e9daMon, 29 Jun 2020 19:40:20 GMT\"0x8D81C644212184A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:40:21 GMT", + "x-ms-client-request-id" : "f22db0d1-0a67-4b63-bae2-6e7810f46a25", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata279163fca7e9da?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "175a560c-bfee-4712-8199-350af34f8d20" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "f66e798a-301e-011b-474d-4e79da000000", + "Date" : "Mon, 29 Jun 2020 19:40:20 GMT", + "x-ms-client-request-id" : "175a560c-bfee-4712-8199-350af34f8d20" + }, + "Exception" : null + } ], + "variables" : [ "jtcazureblobfileattributeviewsetmetadata00333393f5fe0b", "jtcazureblobfileattributeviewsetmetadata1287156eea4813", "jtcazureblobfileattributeviewsetmetadata279163fca7e9da", "javablobazureblobfileattributeviewsetmetadata3305536d3f34" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazureblobfileattributeviewsetmetadata[1].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazureblobfileattributeviewsetmetadata[1].json new file mode 100644 index 000000000000..3dad97b8493c --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazureblobfileattributeviewsetmetadata[1].json @@ -0,0 +1,227 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata148312f97609d5?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "a22cab92-03cf-4952-97bf-fd928eb319b9" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "e77b3974-c01e-0067-644d-4ea2ba000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:e77b3974-c01e-0067-644d-4ea2ba000000\nTime:2020-06-29T19:40:21.5072183Z", + "Date" : "Mon, 29 Jun 2020 19:40:21 GMT", + "x-ms-client-request-id" : "a22cab92-03cf-4952-97bf-fd928eb319b9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata148312f97609d5?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "1b770d4d-10a6-4714-b628-6410cdeaa384" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6442D5B8DB", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d2c7066c-f01e-00a3-224d-4edd7c000000", + "Date" : "Mon, 29 Jun 2020 19:40:21 GMT", + "x-ms-client-request-id" : "1b770d4d-10a6-4714-b628-6410cdeaa384" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata289903ced97ff8?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "33adbf86-5cb3-4188-a6a6-8bffc6f02b10" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "69ef3223-101e-0003-154d-4e121a000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:69ef3223-101e-0003-154d-4e121a000000\nTime:2020-06-29T19:40:21.8727187Z", + "Date" : "Mon, 29 Jun 2020 19:40:21 GMT", + "x-ms-client-request-id" : "33adbf86-5cb3-4188-a6a6-8bffc6f02b10", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata289903ced97ff8?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "4bcf3639-c0b6-4bf7-a7bd-b4bfa543b9e7" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C64430DFBB6", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9f56b4b3-e01e-007b-614d-4e7aad000000", + "Date" : "Mon, 29 Jun 2020 19:40:21 GMT", + "x-ms-client-request-id" : "4bcf3639-c0b6-4bf7-a7bd-b4bfa543b9e7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata148312f97609d5/javablobazureblobfileattributeviewsetmetadata348754339750", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "029e601e-542d-4d65-ae61-2d869efc9972", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:40:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D81C644327CC24", + "Content-Length" : "0", + "x-ms-request-id" : "561b890e-b01e-00a4-3d4d-4e2bf9000000", + "x-ms-client-request-id" : "029e601e-542d-4d65-ae61-2d869efc9972" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata148312f97609d5/javablobazureblobfileattributeviewsetmetadata348754339750?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "64a15ccc-90cd-45de-958c-755702fda38e" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C64434174E4", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2cd136c1-b01e-00e0-084d-4ef795000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:40:21 GMT", + "x-ms-client-request-id" : "64a15ccc-90cd-45de-958c-755702fda38e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata148312f97609d5/javablobazureblobfileattributeviewsetmetadata348754339750", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "074acc39-1dfb-45b3-a010-be1a2949d322" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:22 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:40:21 GMT", + "x-ms-meta-foo" : "bar", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "0x8D81C64434174E4", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:40:22 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "a314ec56-701e-0090-544d-4e8451000000", + "x-ms-meta-fizz" : "buzz", + "x-ms-client-request-id" : "074acc39-1dfb-45b3-a010-be1a2949d322", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata148312f97609d5?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "1c613d0f-9762-4ce9-8d2e-8c5cc2456074" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5abdfd3-701e-011c-3a4d-4e8f5f000000", + "Date" : "Mon, 29 Jun 2020 19:40:22 GMT", + "x-ms-client-request-id" : "1c613d0f-9762-4ce9-8d2e-8c5cc2456074" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcazureblobfileattributeviewsetmetadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "7bd67191-f6eb-46be-87f9-2722a2e52ca7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "14605306-901e-00b8-4e4d-4ef3ee000000", + "Body" : "jtcazureblobfileattributeviewsetmetadatajtcazureblobfileattributeviewsetmetadata289903ced97ff8Mon, 29 Jun 2020 19:40:22 GMT\"0x8D81C64430DFBB6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:40:21 GMT", + "x-ms-client-request-id" : "7bd67191-f6eb-46be-87f9-2722a2e52ca7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata289903ced97ff8?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "e3aedc72-f5f2-4e78-8371-b3534c9f53dd" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d582816d-401e-0054-1b4d-4efb97000000", + "Date" : "Mon, 29 Jun 2020 19:40:22 GMT", + "x-ms-client-request-id" : "e3aedc72-f5f2-4e78-8371-b3534c9f53dd" + }, + "Exception" : null + } ], + "variables" : [ "jtcazureblobfileattributeviewsetmetadata0727936d06d434", "jtcazureblobfileattributeviewsetmetadata148312f97609d5", "jtcazureblobfileattributeviewsetmetadata289903ced97ff8", "javablobazureblobfileattributeviewsetmetadata348754339750" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazureblobfileattributeviewsetmetadata[2].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazureblobfileattributeviewsetmetadata[2].json new file mode 100644 index 000000000000..fbcba48165d1 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazureblobfileattributeviewsetmetadata[2].json @@ -0,0 +1,227 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata142301485adc3d?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "dc77676e-ad75-4e76-819f-fd596ae57e37" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "f47dc1f5-b01e-0068-2e4d-4e4f4c000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:f47dc1f5-b01e-0068-2e4d-4e4f4c000000\nTime:2020-06-29T19:40:23.1728842Z", + "Date" : "Mon, 29 Jun 2020 19:40:23 GMT", + "x-ms-client-request-id" : "dc77676e-ad75-4e76-819f-fd596ae57e37", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata142301485adc3d?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "090ac837-bbd3-4e48-a76f-8bba73bf7b75" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6443D4C551", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "81d02ca4-501e-00e1-474d-4ef668000000", + "Date" : "Mon, 29 Jun 2020 19:40:22 GMT", + "x-ms-client-request-id" : "090ac837-bbd3-4e48-a76f-8bba73bf7b75" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata25792548be6df6?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "54694ec0-f88b-40e5-86db-4908f41577af" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "98da0bb8-501e-00a5-5a4d-4e2a04000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:98da0bb8-501e-00a5-5a4d-4e2a04000000\nTime:2020-06-29T19:40:23.4748585Z", + "Date" : "Mon, 29 Jun 2020 19:40:23 GMT", + "x-ms-client-request-id" : "54694ec0-f88b-40e5-86db-4908f41577af", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata25792548be6df6?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "1b447276-7b06-4d55-b2d5-a5854487f981" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C64440592A4", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "5badda8c-b01e-0005-1f4d-4ee562000000", + "Date" : "Mon, 29 Jun 2020 19:40:23 GMT", + "x-ms-client-request-id" : "1b447276-7b06-4d55-b2d5-a5854487f981" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata142301485adc3d/javablobazureblobfileattributeviewsetmetadata380542cec541", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "51e0672f-4b99-4738-8ceb-7a2f4160a6a0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:40:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D81C64441E4F37", + "Content-Length" : "0", + "x-ms-request-id" : "6fb867c2-b01e-0041-5a4d-4e390e000000", + "x-ms-client-request-id" : "51e0672f-4b99-4738-8ceb-7a2f4160a6a0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata142301485adc3d/javablobazureblobfileattributeviewsetmetadata380542cec541?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "888419c8-632d-4349-a6cb-a5e053fc9451" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C644435AD83", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "bb253f8b-801e-0109-624d-4e4dc6000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:40:23 GMT", + "x-ms-client-request-id" : "888419c8-632d-4349-a6cb-a5e053fc9451" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata142301485adc3d/javablobazureblobfileattributeviewsetmetadata380542cec541", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "3ce915d2-140a-43fd-a25d-a8df6588d4ad" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:40:23 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-meta-i_" : "a", + "Date" : "Mon, 29 Jun 2020 19:40:23 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "0x8D81C644435AD83", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:40:23 GMT", + "Content-Length" : "7", + "x-ms-meta-i0" : "a", + "x-ms-request-id" : "266d4e72-501e-0069-554d-4e4eb1000000", + "x-ms-client-request-id" : "3ce915d2-140a-43fd-a25d-a8df6588d4ad", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata142301485adc3d?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "c67477dc-9985-4a8f-9d1c-373df50adaf3" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ef11234d-901e-0019-144d-4e3d75000000", + "Date" : "Mon, 29 Jun 2020 19:40:23 GMT", + "x-ms-client-request-id" : "c67477dc-9985-4a8f-9d1c-373df50adaf3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcazureblobfileattributeviewsetmetadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "fb40324c-de86-427a-a354-a4179fb5aa5c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "4e738b91-601e-00e2-774d-4ef56f000000", + "Body" : "jtcazureblobfileattributeviewsetmetadatajtcazureblobfileattributeviewsetmetadata25792548be6df6Mon, 29 Jun 2020 19:40:23 GMT\"0x8D81C64440592A4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:40:23 GMT", + "x-ms-client-request-id" : "fb40324c-de86-427a-a354-a4179fb5aa5c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsetmetadata25792548be6df6?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "7e3bf435-3366-4a33-85ff-2d49644a7613" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "99295a1b-401e-00ba-384d-4ef114000000", + "Date" : "Mon, 29 Jun 2020 19:40:24 GMT", + "x-ms-client-request-id" : "7e3bf435-3366-4a33-85ff-2d49644a7613" + }, + "Exception" : null + } ], + "variables" : [ "jtcazureblobfileattributeviewsetmetadata0838483b91d445", "jtcazureblobfileattributeviewsetmetadata142301485adc3d", "jtcazureblobfileattributeviewsetmetadata25792548be6df6", "javablobazureblobfileattributeviewsetmetadata380542cec541" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazureblobfileattributeviewsettier[0].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazureblobfileattributeviewsettier[0].json new file mode 100644 index 000000000000..d25d1f4febd2 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazureblobfileattributeviewsettier[0].json @@ -0,0 +1,224 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsettier16403717bac9fde3?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "e67a1913-8d3a-4d86-bc4a-cc31e5535e32" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "94ab526a-801e-0087-804d-4e01fb000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:94ab526a-801e-0087-804d-4e01fb000000\nTime:2020-06-29T19:42:05.6979964Z", + "Date" : "Mon, 29 Jun 2020 19:42:05 GMT", + "x-ms-client-request-id" : "e67a1913-8d3a-4d86-bc4a-cc31e5535e32", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsettier16403717bac9fde3?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "d12ffd05-80d4-4582-af0f-f528e1f77efe" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C648105E4EC", + "Last-Modified" : "Mon, 29 Jun 2020 19:42:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9503a53d-001e-005a-064d-4e5255000000", + "Date" : "Mon, 29 Jun 2020 19:42:05 GMT", + "x-ms-client-request-id" : "d12ffd05-80d4-4582-af0f-f528e1f77efe" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsettier28785554ed0c1983?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "75f9a02b-b3a2-4c18-8611-14f02768dd19" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "aab76c63-301e-0130-3d4d-4e48ab000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:aab76c63-301e-0130-3d4d-4e48ab000000\nTime:2020-06-29T19:42:06.2673923Z", + "Date" : "Mon, 29 Jun 2020 19:42:05 GMT", + "x-ms-client-request-id" : "75f9a02b-b3a2-4c18-8611-14f02768dd19", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsettier28785554ed0c1983?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "eff4608b-ee70-4ea8-b96a-01e149987561" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C64814BB9B9", + "Last-Modified" : "Mon, 29 Jun 2020 19:42:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "996947dc-601e-0027-544d-4ece9d000000", + "Date" : "Mon, 29 Jun 2020 19:42:05 GMT", + "x-ms-client-request-id" : "eff4608b-ee70-4ea8-b96a-01e149987561" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsettier16403717bac9fde3/javablobazureblobfileattributeviewsettier3622648397f146", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "02e713bf-9d6a-44d0-a572-b5f65d2fec55", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 29 Jun 2020 19:42:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:42:06 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D81C64817623DD", + "Content-Length" : "0", + "x-ms-request-id" : "d02510fa-001e-0111-524d-4e259a000000", + "x-ms-client-request-id" : "02e713bf-9d6a-44d0-a572-b5f65d2fec55" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsettier16403717bac9fde3/javablobazureblobfileattributeviewsettier3622648397f146?comp=tier", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "ab3ef49b-eeb2-4797-988b-6abc27f67104" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f976cd99-001e-0133-554d-4e4bac000000", + "Date" : "Mon, 29 Jun 2020 19:42:06 GMT", + "x-ms-client-request-id" : "ab3ef49b-eeb2-4797-988b-6abc27f67104" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsettier16403717bac9fde3/javablobazureblobfileattributeviewsettier3622648397f146", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "2ae52def-193b-4684-8c00-38735b056980" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:42:06 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Mon, 29 Jun 2020 19:42:06 GMT", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:42:06 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "0x8D81C64817623DD", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:42:06 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d9b42df1-f01e-0066-314d-4ee68e000000", + "x-ms-client-request-id" : "2ae52def-193b-4684-8c00-38735b056980", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsettier16403717bac9fde3?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "3d14d0ba-00af-4ccf-8c17-78d24cd91d58" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "35599041-e01e-001f-6f4d-4e8fc4000000", + "Date" : "Mon, 29 Jun 2020 19:42:06 GMT", + "x-ms-client-request-id" : "3d14d0ba-00af-4ccf-8c17-78d24cd91d58" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcazureblobfileattributeviewsettier&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "f60989f8-b3be-420d-ad50-6e228e01c22f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f154804f-f01e-004f-0b4d-4e90cc000000", + "Body" : "jtcazureblobfileattributeviewsettierjtcazureblobfileattributeviewsettier28785554ed0c1983Mon, 29 Jun 2020 19:42:06 GMT\"0x8D81C64814BB9B9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:42:07 GMT", + "x-ms-client-request-id" : "f60989f8-b3be-420d-ad50-6e228e01c22f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsettier28785554ed0c1983?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "0d7bc3ea-6ce9-40df-afb1-c382aa186013" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e1aa1f9c-f01e-0022-2b4d-4e3ae2000000", + "Date" : "Mon, 29 Jun 2020 19:42:07 GMT", + "x-ms-client-request-id" : "0d7bc3ea-6ce9-40df-afb1-c382aa186013" + }, + "Exception" : null + } ], + "variables" : [ "jtcazureblobfileattributeviewsettier05054601aef07cf2", "jtcazureblobfileattributeviewsettier16403717bac9fde3", "jtcazureblobfileattributeviewsettier28785554ed0c1983", "javablobazureblobfileattributeviewsettier3622648397f146" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazureblobfileattributeviewsettier[1].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazureblobfileattributeviewsettier[1].json new file mode 100644 index 000000000000..02bec207e790 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AttributeViewTestazureblobfileattributeviewsettier[1].json @@ -0,0 +1,224 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsettier1757622a024031c6?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "9d4216ba-e55e-4b9f-aa98-d86c32b25d54" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "2b562259-d01e-001c-1a4d-4e8cc3000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:2b562259-d01e-001c-1a4d-4e8cc3000000\nTime:2020-06-29T19:42:07.9535880Z", + "Date" : "Mon, 29 Jun 2020 19:42:07 GMT", + "x-ms-client-request-id" : "9d4216ba-e55e-4b9f-aa98-d86c32b25d54", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsettier1757622a024031c6?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "c57cb720-d23d-408e-b259-cfcf07d82987" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C64824DFE73", + "Last-Modified" : "Mon, 29 Jun 2020 19:42:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "73b50610-d01e-007a-564d-4e3e99000000", + "Date" : "Mon, 29 Jun 2020 19:42:07 GMT", + "x-ms-client-request-id" : "c57cb720-d23d-408e-b259-cfcf07d82987" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsettier2330897c44b6c432?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "e6d2124c-48c4-47e7-b6be-2d3d03cc30d8" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "9ddcf8c6-a01e-0075-464d-4ed36f000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:9ddcf8c6-a01e-0075-464d-4ed36f000000\nTime:2020-06-29T19:42:08.3300756Z", + "Date" : "Mon, 29 Jun 2020 19:42:08 GMT", + "x-ms-client-request-id" : "e6d2124c-48c4-47e7-b6be-2d3d03cc30d8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsettier2330897c44b6c432?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "55a0701c-bdf9-41a1-961b-2d66b06678b1" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6482838410", + "Last-Modified" : "Mon, 29 Jun 2020 19:42:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "5c614b57-e01e-0097-5e4d-4e371d000000", + "Date" : "Mon, 29 Jun 2020 19:42:07 GMT", + "x-ms-client-request-id" : "55a0701c-bdf9-41a1-961b-2d66b06678b1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsettier1757622a024031c6/javablobazureblobfileattributeviewsettier346219b60f98ce", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "9c61684a-c4c3-4ebf-9cb8-72c70980cfa3", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 29 Jun 2020 19:42:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:42:08 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D81C64829ED551", + "Content-Length" : "0", + "x-ms-request-id" : "fd473b76-501e-0042-544d-4e7fc0000000", + "x-ms-client-request-id" : "9c61684a-c4c3-4ebf-9cb8-72c70980cfa3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsettier1757622a024031c6/javablobazureblobfileattributeviewsettier346219b60f98ce?comp=tier", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "c821b4c7-a09f-450c-87b4-9c2f43a2f4c7" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0d141355-101e-00a0-2a4d-4e9bb2000000", + "Date" : "Mon, 29 Jun 2020 19:42:08 GMT", + "x-ms-client-request-id" : "c821b4c7-a09f-450c-87b4-9c2f43a2f4c7" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsettier1757622a024031c6/javablobazureblobfileattributeviewsettier346219b60f98ce", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "d2ff5e6b-48c0-4b38-be5c-1350e01ff144" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:42:08 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Mon, 29 Jun 2020 19:42:08 GMT", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:42:08 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "Cool", + "ETag" : "0x8D81C64829ED551", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:42:08 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "23f41045-601e-004a-794d-4e64b3000000", + "x-ms-client-request-id" : "d2ff5e6b-48c0-4b38-be5c-1350e01ff144", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsettier1757622a024031c6?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "897a88be-aebe-45c4-bfc7-9397056313e0" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "66c55342-301e-001d-304d-4e8d3e000000", + "Date" : "Mon, 29 Jun 2020 19:42:09 GMT", + "x-ms-client-request-id" : "897a88be-aebe-45c4-bfc7-9397056313e0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcazureblobfileattributeviewsettier&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "a87fe5e6-93bb-46a5-8814-617ea0331785" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "fefc6e13-301e-00f3-4e4d-4e87bd000000", + "Body" : "jtcazureblobfileattributeviewsettierjtcazureblobfileattributeviewsettier2330897c44b6c432Mon, 29 Jun 2020 19:42:08 GMT\"0x8D81C6482838410\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:42:08 GMT", + "x-ms-client-request-id" : "a87fe5e6-93bb-46a5-8814-617ea0331785", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcazureblobfileattributeviewsettier2330897c44b6c432?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "0e57924e-6aad-4f0c-b0d0-4f43bca9cec6" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "2c4d3e4b-901e-00b1-344d-4eaca9000000", + "Date" : "Mon, 29 Jun 2020 19:42:08 GMT", + "x-ms-client-request-id" : "0e57924e-6aad-4f0c-b0d0-4f43bca9cec6" + }, + "Exception" : null + } ], + "variables" : [ "jtcazureblobfileattributeviewsettier0324329d575cd932", "jtcazureblobfileattributeviewsettier1757622a024031c6", "jtcazureblobfileattributeviewsettier2330897c44b6c432", "javablobazureblobfileattributeviewsettier346219b60f98ce" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestgetattributeview[0].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestgetattributeview[0].json new file mode 100644 index 000000000000..d0c6b839c2c1 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestgetattributeview[0].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcgetattributeview1827023ff8b88e0ee844bd849?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "919109d6-f52c-474e-8ac5-eafb661f9556" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "c79c8124-901e-00dc-1f4d-4e0687000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:c79c8124-901e-00dc-1f4d-4e0687000000\nTime:2020-06-29T19:45:31.7824720Z", + "Date" : "Mon, 29 Jun 2020 19:45:31 GMT", + "x-ms-client-request-id" : "919109d6-f52c-474e-8ac5-eafb661f9556", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcgetattributeview1827023ff8b88e0ee844bd849?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "d2e77d49-0dfb-45f3-8233-0bb4d884b8b3" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C64FBC6A221", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36bb7247-101e-0127-544d-4e88c8000000", + "Date" : "Mon, 29 Jun 2020 19:45:31 GMT", + "x-ms-client-request-id" : "d2e77d49-0dfb-45f3-8233-0bb4d884b8b3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcgetattributeview299157358ef0c781e245f8b49?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "52e1deac-f712-451b-8f2d-a5a18099fbf5" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "3b34bc79-101e-0045-184d-4e8945000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:3b34bc79-101e-0045-184d-4e8945000000\nTime:2020-06-29T19:45:32.1182007Z", + "Date" : "Mon, 29 Jun 2020 19:45:31 GMT", + "x-ms-client-request-id" : "52e1deac-f712-451b-8f2d-a5a18099fbf5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcgetattributeview299157358ef0c781e245f8b49?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "c282bc41-035d-409a-af11-a0056b3ccf07" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C64FBFA09FB", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f602f130-d01e-0017-804d-4e94b7000000", + "Date" : "Mon, 29 Jun 2020 19:45:31 GMT", + "x-ms-client-request-id" : "c282bc41-035d-409a-af11-a0056b3ccf07" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcgetattributeview&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "f5f14aec-4bb3-4f44-b830-16aba06d9420" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f71e29fc-201e-008a-434d-4eeef7000000", + "Body" : "jtcgetattributeviewjtcgetattributeview1827023ff8b88e0ee844bd849Mon, 29 Jun 2020 19:45:31 GMT\"0x8D81C64FBC6A221\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcgetattributeview299157358ef0c781e245f8b49Mon, 29 Jun 2020 19:45:32 GMT\"0x8D81C64FBFA09FB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:45:31 GMT", + "x-ms-client-request-id" : "f5f14aec-4bb3-4f44-b830-16aba06d9420", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcgetattributeview1827023ff8b88e0ee844bd849?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "7c74e59d-374b-434e-af9b-9d187ed7d013" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8ccc5dc4-001e-0138-3b4d-4e53d8000000", + "Date" : "Mon, 29 Jun 2020 19:45:32 GMT", + "x-ms-client-request-id" : "7c74e59d-374b-434e-af9b-9d187ed7d013" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcgetattributeview299157358ef0c781e245f8b49?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "48fa325b-fa23-422b-948b-648c3957abcd" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "1c1c0428-b01e-0043-584d-4e7e3d000000", + "Date" : "Mon, 29 Jun 2020 19:45:32 GMT", + "x-ms-client-request-id" : "48fa325b-fa23-422b-948b-648c3957abcd" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetattributeview0505232cefeeac4acc4777980", "jtcgetattributeview1827023ff8b88e0ee844bd849", "jtcgetattributeview299157358ef0c781e245f8b49" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestgetattributeview[1].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestgetattributeview[1].json new file mode 100644 index 000000000000..02b1b86bafd2 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestgetattributeview[1].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcgetattributeview1721429ff3dcd4f42b4c77826?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "4b8734a6-107b-47f0-ae12-c2b71508db18" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "33a3e1a3-e01e-00f1-534d-4e8547000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:33a3e1a3-e01e-00f1-534d-4e8547000000\nTime:2020-06-29T19:45:32.9264757Z", + "Date" : "Mon, 29 Jun 2020 19:45:32 GMT", + "x-ms-client-request-id" : "4b8734a6-107b-47f0-ae12-c2b71508db18", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcgetattributeview1721429ff3dcd4f42b4c77826?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "c7fcd0e5-bd14-4061-9cff-4bf310cb6245" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C64FC75C8C3", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c6bc61da-a01e-009b-634d-4ed9ec000000", + "Date" : "Mon, 29 Jun 2020 19:45:32 GMT", + "x-ms-client-request-id" : "c7fcd0e5-bd14-4061-9cff-4bf310cb6245" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcgetattributeview2351514c448dc0352e44a49fe?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "8a1b7de2-0164-401b-93ea-4587cd9ae3aa" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "489b55fb-101e-000a-0b4d-4e4d5d000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:489b55fb-101e-000a-0b4d-4e4d5d000000\nTime:2020-06-29T19:45:33.2324703Z", + "Date" : "Mon, 29 Jun 2020 19:45:32 GMT", + "x-ms-client-request-id" : "8a1b7de2-0164-401b-93ea-4587cd9ae3aa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcgetattributeview2351514c448dc0352e44a49fe?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "7caef204-3769-41d9-a5b2-4148b824798d" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C64FCA55265", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "373fdf96-601e-002c-504d-4ed6e9000000", + "Date" : "Mon, 29 Jun 2020 19:45:33 GMT", + "x-ms-client-request-id" : "7caef204-3769-41d9-a5b2-4148b824798d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcgetattributeview&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "9e984eaa-0331-4d7d-846a-2818e614496d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9d0cb172-901e-0076-104d-4ed068000000", + "Body" : "jtcgetattributeviewjtcgetattributeview1721429ff3dcd4f42b4c77826Mon, 29 Jun 2020 19:45:33 GMT\"0x8D81C64FC75C8C3\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcgetattributeview2351514c448dc0352e44a49feMon, 29 Jun 2020 19:45:33 GMT\"0x8D81C64FCA55265\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:45:32 GMT", + "x-ms-client-request-id" : "9e984eaa-0331-4d7d-846a-2818e614496d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcgetattributeview1721429ff3dcd4f42b4c77826?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "0b379038-bb62-4682-9d6f-5488aed702e4" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "dae7ece7-c01e-0021-194d-4e39e5000000", + "Date" : "Mon, 29 Jun 2020 19:45:33 GMT", + "x-ms-client-request-id" : "0b379038-bb62-4682-9d6f-5488aed702e4" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcgetattributeview2351514c448dc0352e44a49fe?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "043f3a00-f55e-41b2-b278-7c560a4d08eb" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "74e2a720-b01e-0007-134d-4ea251000000", + "Date" : "Mon, 29 Jun 2020 19:45:33 GMT", + "x-ms-client-request-id" : "043f3a00-f55e-41b2-b278-7c560a4d08eb" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetattributeview08965633c78a85d79e4864aff", "jtcgetattributeview1721429ff3dcd4f42b4c77826", "jtcgetattributeview2351514c448dc0352e44a49fe" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestgetattributeview[2].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestgetattributeview[2].json new file mode 100644 index 000000000000..e8d664a2e835 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestgetattributeview[2].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcgetattributeview14190618282686d1264fdfb77?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "172f8eb2-d379-43dc-ab86-9837d670f047" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "49882869-c01e-002a-484d-4e2191000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:49882869-c01e-002a-484d-4e2191000000\nTime:2020-06-29T19:45:34.0847958Z", + "Date" : "Mon, 29 Jun 2020 19:45:33 GMT", + "x-ms-client-request-id" : "172f8eb2-d379-43dc-ab86-9837d670f047", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcgetattributeview14190618282686d1264fdfb77?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "c741d296-e6a9-4e71-8e32-92eeb5c0923f" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C64FD274EB5", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f9c5ee71-901e-0010-6b4d-4e6232000000", + "Date" : "Mon, 29 Jun 2020 19:45:33 GMT", + "x-ms-client-request-id" : "c741d296-e6a9-4e71-8e32-92eeb5c0923f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcgetattributeview238785f95f5967d1f44512a23?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "5c6d7b43-6377-48c9-b47f-b158465ac75d" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "2ed4943d-101e-010e-6f4d-4efe8a000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:2ed4943d-101e-010e-6f4d-4efe8a000000\nTime:2020-06-29T19:45:34.4057381Z", + "Date" : "Mon, 29 Jun 2020 19:45:34 GMT", + "x-ms-client-request-id" : "5c6d7b43-6377-48c9-b47f-b158465ac75d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcgetattributeview238785f95f5967d1f44512a23?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "ac0d4317-ea62-4e74-89f4-30e2bd5a3046" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C64FD56F5B1", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "344d69e5-801e-00a5-7c4d-4e6fcd000000", + "Date" : "Mon, 29 Jun 2020 19:45:34 GMT", + "x-ms-client-request-id" : "ac0d4317-ea62-4e74-89f4-30e2bd5a3046" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcgetattributeview&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "314db43c-4903-4347-893e-c67e744adf39" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "464e79de-501e-012b-5a4d-4e6639000000", + "Body" : "jtcgetattributeviewjtcgetattributeview14190618282686d1264fdfb77Mon, 29 Jun 2020 19:45:34 GMT\"0x8D81C64FD274EB5\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcgetattributeview238785f95f5967d1f44512a23Mon, 29 Jun 2020 19:45:34 GMT\"0x8D81C64FD56F5B1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:45:34 GMT", + "x-ms-client-request-id" : "314db43c-4903-4347-893e-c67e744adf39", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcgetattributeview14190618282686d1264fdfb77?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "932eaef7-388a-45df-b469-1a2df095aff5" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b9f03348-e01e-0139-794d-4e5225000000", + "Date" : "Mon, 29 Jun 2020 19:45:34 GMT", + "x-ms-client-request-id" : "932eaef7-388a-45df-b469-1a2df095aff5" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcgetattributeview238785f95f5967d1f44512a23?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "75d0e120-2ead-4c21-bf5a-e741715dea61" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "448600de-101e-006c-6e4d-4eff07000000", + "Date" : "Mon, 29 Jun 2020 19:45:35 GMT", + "x-ms-client-request-id" : "75d0e120-2ead-4c21-bf5a-e741715dea61" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetattributeview082365367a3876622347139b6", "jtcgetattributeview14190618282686d1264fdfb77", "jtcgetattributeview238785f95f5967d1f44512a23" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestgetattributeviewfail.json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestgetattributeviewfail.json new file mode 100644 index 000000000000..3bea5cec8736 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestgetattributeviewfail.json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcgetattributeviewfail156895e91684fbfd724bcca?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "a3b49de1-6ce6-47a8-aa92-ab3adadaffa3" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "0f9dcdd8-c01e-00a2-7c4d-4e9948000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:0f9dcdd8-c01e-00a2-7c4d-4e9948000000\nTime:2020-06-29T19:45:35.2906740Z", + "Date" : "Mon, 29 Jun 2020 19:45:34 GMT", + "x-ms-client-request-id" : "a3b49de1-6ce6-47a8-aa92-ab3adadaffa3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcgetattributeviewfail156895e91684fbfd724bcca?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "42ad1d5f-acb2-45c8-a3a7-b783e0a30500" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C64FDDEDE20", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "12d65cac-201e-00ec-3b4d-4e5cad000000", + "Date" : "Mon, 29 Jun 2020 19:45:34 GMT", + "x-ms-client-request-id" : "42ad1d5f-acb2-45c8-a3a7-b783e0a30500" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcgetattributeviewfail24734322f202a38c4941a28?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "0174281e-f209-44c9-aef4-8dc640c7ac2d" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "fa3f01b6-701e-0137-424d-4ebe2e000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:fa3f01b6-701e-0137-424d-4ebe2e000000\nTime:2020-06-29T19:45:35.6081996Z", + "Date" : "Mon, 29 Jun 2020 19:45:35 GMT", + "x-ms-client-request-id" : "0174281e-f209-44c9-aef4-8dc640c7ac2d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcgetattributeviewfail24734322f202a38c4941a28?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "966605ab-c303-4c30-8d86-38f34d190e8e" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C64FE10E9E4", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d18ee765-a01e-00b9-014d-4eb7da000000", + "Date" : "Mon, 29 Jun 2020 19:45:35 GMT", + "x-ms-client-request-id" : "966605ab-c303-4c30-8d86-38f34d190e8e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcgetattributeviewfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "dbde5fb0-a89e-4560-88f8-fd12da230fcf" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "98e74895-f01e-0000-484d-4e54d4000000", + "Body" : "jtcgetattributeviewfailjtcgetattributeviewfail156895e91684fbfd724bccaMon, 29 Jun 2020 19:45:35 GMT\"0x8D81C64FDDEDE20\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcgetattributeviewfail24734322f202a38c4941a28Mon, 29 Jun 2020 19:45:35 GMT\"0x8D81C64FE10E9E4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:45:35 GMT", + "x-ms-client-request-id" : "dbde5fb0-a89e-4560-88f8-fd12da230fcf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcgetattributeviewfail156895e91684fbfd724bcca?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "8b31b859-25ea-4479-976e-fbb3768bb3b5" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "5e64d9d4-d01e-013a-7a4d-4e5122000000", + "Date" : "Mon, 29 Jun 2020 19:45:35 GMT", + "x-ms-client-request-id" : "8b31b859-25ea-4479-976e-fbb3768bb3b5" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcgetattributeviewfail24734322f202a38c4941a28?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "dadf4174-5e71-4a73-b465-c6a92a04d129" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "93efcd44-d01e-0058-014d-4e50af000000", + "Date" : "Mon, 29 Jun 2020 19:45:36 GMT", + "x-ms-client-request-id" : "dadf4174-5e71-4a73-b465-c6a92a04d129" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetattributeviewfail0358107f8dc065e633464c9", "jtcgetattributeviewfail156895e91684fbfd724bcca", "jtcgetattributeviewfail24734322f202a38c4941a28" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributes[0].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributes[0].json new file mode 100644 index 000000000000..c0314b940817 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributes[0].json @@ -0,0 +1,226 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes1701372bf64e5ff9c9491c8e30?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "5ebf5246-af1d-40da-8b7d-3a2b6331870b" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "a7368318-e01e-011b-384d-4e3c13000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:a7368318-e01e-011b-384d-4e3c13000000\nTime:2020-06-29T19:45:36.4498207Z", + "Date" : "Mon, 29 Jun 2020 19:45:35 GMT", + "x-ms-client-request-id" : "5ebf5246-af1d-40da-8b7d-3a2b6331870b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes1701372bf64e5ff9c9491c8e30?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "8822fc42-9917-4b51-914d-c1d0b488a6df" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C64FE8E8FF5", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e081ee5e-901e-0039-504d-4e1470000000", + "Date" : "Mon, 29 Jun 2020 19:45:36 GMT", + "x-ms-client-request-id" : "8822fc42-9917-4b51-914d-c1d0b488a6df" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes24408765e81ae966394273ad0f?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "2a4a00b1-cfce-4c82-9c17-58659025e417" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "d026901e-a01e-00d4-674d-4e1df4000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:d026901e-a01e-00d4-674d-4e1df4000000\nTime:2020-06-29T19:45:36.7652195Z", + "Date" : "Mon, 29 Jun 2020 19:45:36 GMT", + "x-ms-client-request-id" : "2a4a00b1-cfce-4c82-9c17-58659025e417", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes24408765e81ae966394273ad0f?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "a3bdb9c0-1c8a-479c-9dd2-86134b5b6def" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C64FEBF99DD", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d692dba9-701e-011e-584d-4ec86c000000", + "Date" : "Mon, 29 Jun 2020 19:45:36 GMT", + "x-ms-client-request-id" : "a3bdb9c0-1c8a-479c-9dd2-86134b5b6def" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes1701372bf64e5ff9c9491c8e30?prefix=javablobreadattributes3693385eb34037e92e4a88b&delimiter=/&maxresults=2&include=metadata&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "789af3cf-f516-4d9c-84fd-93bde30c4efd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c56d9bfe-101e-012c-104d-4e90bc000000", + "Body" : "javablobreadattributes3693385eb34037e92e4a88b2/", + "Date" : "Mon, 29 Jun 2020 19:45:36 GMT", + "x-ms-client-request-id" : "789af3cf-f516-4d9c-84fd-93bde30c4efd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes1701372bf64e5ff9c9491c8e30/javablobreadattributes3693385eb34037e92e4a88b", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "8ba5ea6f-1675-4741-b61b-6ce459984804", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "AAAAAAAAAAA=", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:45:36 GMT", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "ETag" : "0x8D81C64FEEE9E23", + "Content-Length" : "0", + "x-ms-request-id" : "4ed71c9c-901e-005f-804d-4ea62a000000", + "x-ms-client-request-id" : "8ba5ea6f-1675-4741-b61b-6ce459984804" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes1701372bf64e5ff9c9491c8e30/javablobreadattributes3693385eb34037e92e4a88b", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "9855ca12-5fa6-4e07-a2a4-87cfc301262a" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:37 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:45:36 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "0x8D81C64FEEE9E23", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:45:37 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "85bebb0e-a01e-0135-7d4d-4ebcd4000000", + "x-ms-client-request-id" : "9855ca12-5fa6-4e07-a2a4-87cfc301262a", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcreadattributes&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "996f094f-99e5-4498-b9dd-9085cb44b672" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "3814873c-b01e-008f-594d-4e1a88000000", + "Body" : "jtcreadattributesjtcreadattributes1701372bf64e5ff9c9491c8e30Mon, 29 Jun 2020 19:45:36 GMT\"0x8D81C64FE8E8FF5\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcreadattributes24408765e81ae966394273ad0fMon, 29 Jun 2020 19:45:36 GMT\"0x8D81C64FEBF99DD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:45:36 GMT", + "x-ms-client-request-id" : "996f094f-99e5-4498-b9dd-9085cb44b672", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes1701372bf64e5ff9c9491c8e30?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "451227d9-0cf4-4175-9923-1583a146052b" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "fc01e6c2-101e-00c6-1d4d-4e29e8000000", + "Date" : "Mon, 29 Jun 2020 19:45:37 GMT", + "x-ms-client-request-id" : "451227d9-0cf4-4175-9923-1583a146052b" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes24408765e81ae966394273ad0f?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "d912a0c6-5540-4285-89a5-d7c6e8cfe4da" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "963db55e-501e-00e8-564d-4ea92f000000", + "Date" : "Mon, 29 Jun 2020 19:45:37 GMT", + "x-ms-client-request-id" : "d912a0c6-5540-4285-89a5-d7c6e8cfe4da" + }, + "Exception" : null + } ], + "variables" : [ "jtcreadattributes0317549337817c77e8481fbc4f", "jtcreadattributes1701372bf64e5ff9c9491c8e30", "jtcreadattributes24408765e81ae966394273ad0f", "javablobreadattributes3693385eb34037e92e4a88b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributes[1].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributes[1].json new file mode 100644 index 000000000000..7f0e5640495a --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributes[1].json @@ -0,0 +1,226 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes188730e6217dbdcf414473ad26?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "8f37e18b-e22a-496e-afe5-364f562079ee" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "8d3595d3-701e-001a-304d-4e7bbb000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:8d3595d3-701e-001a-304d-4e7bbb000000\nTime:2020-06-29T19:45:38.0408267Z", + "Date" : "Mon, 29 Jun 2020 19:45:37 GMT", + "x-ms-client-request-id" : "8f37e18b-e22a-496e-afe5-364f562079ee", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes188730e6217dbdcf414473ad26?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "c212d180-a01b-4568-8113-f33ffc2090f9" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C64FF81E251", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b4674025-e01e-0079-134d-4e3d9e000000", + "Date" : "Mon, 29 Jun 2020 19:45:37 GMT", + "x-ms-client-request-id" : "c212d180-a01b-4568-8113-f33ffc2090f9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes28969347c47658b8c04cecb7f7?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "f866213f-8d3e-4de4-8a82-57f9f1740385" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "8de9392f-601e-00af-2f4d-4e7644000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:8de9392f-601e-00af-2f4d-4e7644000000\nTime:2020-06-29T19:45:38.4168297Z", + "Date" : "Mon, 29 Jun 2020 19:45:38 GMT", + "x-ms-client-request-id" : "f866213f-8d3e-4de4-8a82-57f9f1740385", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes28969347c47658b8c04cecb7f7?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "efc0856d-0c1b-4d32-8f03-0d2298c037a6" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C64FFBAB970", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5bb1034-101e-0082-2d4d-4ef584000000", + "Date" : "Mon, 29 Jun 2020 19:45:37 GMT", + "x-ms-client-request-id" : "efc0856d-0c1b-4d32-8f03-0d2298c037a6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes188730e6217dbdcf414473ad26?prefix=javablobreadattributes3342827d9aa5914c1244308&delimiter=/&maxresults=2&include=metadata&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "039543d5-9394-4ab9-bda3-798048d4c1a4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "325aedef-001e-00d2-184d-4eea8c000000", + "Body" : "javablobreadattributes3342827d9aa5914c12443082/", + "Date" : "Mon, 29 Jun 2020 19:45:38 GMT", + "x-ms-client-request-id" : "039543d5-9394-4ab9-bda3-798048d4c1a4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes188730e6217dbdcf414473ad26/javablobreadattributes3342827d9aa5914c1244308", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "c2fc7258-558f-4876-992d-3b07027f6ebb", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "AAAAAAAAAAA=", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:45:38 GMT", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "ETag" : "0x8D81C64FFEC400A", + "Content-Length" : "0", + "x-ms-request-id" : "a8598dac-f01e-00cc-4a4d-4e3061000000", + "x-ms-client-request-id" : "c2fc7258-558f-4876-992d-3b07027f6ebb" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes188730e6217dbdcf414473ad26/javablobreadattributes3342827d9aa5914c1244308", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "5b2d59a5-d439-442b-8135-8f46ead3415e" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:38 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:45:38 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "0x8D81C64FFEC400A", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:45:38 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "2c1c1843-101e-00ef-804d-4e5faa000000", + "x-ms-client-request-id" : "5b2d59a5-d439-442b-8135-8f46ead3415e", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcreadattributes&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "0ea33eba-9495-4f76-bb0e-4a090d9f1a12" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ef2254a6-501e-00c1-044d-4edf6d000000", + "Body" : "jtcreadattributesjtcreadattributes188730e6217dbdcf414473ad26Mon, 29 Jun 2020 19:45:38 GMT\"0x8D81C64FF81E251\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcreadattributes28969347c47658b8c04cecb7f7Mon, 29 Jun 2020 19:45:38 GMT\"0x8D81C64FFBAB970\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:45:38 GMT", + "x-ms-client-request-id" : "0ea33eba-9495-4f76-bb0e-4a090d9f1a12", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes188730e6217dbdcf414473ad26?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "d29b0a23-f8e0-42bc-ae2a-17e253dabdfa" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d436d6ec-401e-0134-434d-4ebd29000000", + "Date" : "Mon, 29 Jun 2020 19:45:38 GMT", + "x-ms-client-request-id" : "d29b0a23-f8e0-42bc-ae2a-17e253dabdfa" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes28969347c47658b8c04cecb7f7?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "9c0c872a-9fde-410a-b11a-0fb5443a4c4d" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "de6193bf-001e-011a-144d-4e3dee000000", + "Date" : "Mon, 29 Jun 2020 19:45:39 GMT", + "x-ms-client-request-id" : "9c0c872a-9fde-410a-b11a-0fb5443a4c4d" + }, + "Exception" : null + } ], + "variables" : [ "jtcreadattributes001507e20f03db712b4d67a87e", "jtcreadattributes188730e6217dbdcf414473ad26", "jtcreadattributes28969347c47658b8c04cecb7f7", "javablobreadattributes3342827d9aa5914c1244308" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributes[2].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributes[2].json new file mode 100644 index 000000000000..47465f92176f --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributes[2].json @@ -0,0 +1,226 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes1249039482debd86814bbeaec3?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "217e6fee-e6b6-4567-a6ea-3c0a115a88c3" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "2b313f3a-c01e-00c4-0a4d-4e2b12000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:2b313f3a-c01e-00c4-0a4d-4e2b12000000\nTime:2020-06-29T19:45:39.6906407Z", + "Date" : "Mon, 29 Jun 2020 19:45:39 GMT", + "x-ms-client-request-id" : "217e6fee-e6b6-4567-a6ea-3c0a115a88c3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes1249039482debd86814bbeaec3?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "ba4077f1-698a-496e-8952-e4d415430238" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6500814B57", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0ff6ee00-f01e-000b-384d-4e4ca0000000", + "Date" : "Mon, 29 Jun 2020 19:45:39 GMT", + "x-ms-client-request-id" : "ba4077f1-698a-496e-8952-e4d415430238" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes2336411fa00cf302254d739da4?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "fe87a3c3-c865-4b89-a66f-070c9eed54f6" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "4b82c03e-701e-0055-2b4d-4ebfa3000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:4b82c03e-701e-0055-2b4d-4ebfa3000000\nTime:2020-06-29T19:45:40.0472253Z", + "Date" : "Mon, 29 Jun 2020 19:45:39 GMT", + "x-ms-client-request-id" : "fe87a3c3-c865-4b89-a66f-070c9eed54f6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes2336411fa00cf302254d739da4?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "cd9e8401-5b30-4b19-bbc9-091c4528fca5" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6500B47482", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0173c7ca-d01e-009f-134d-4e2c6e000000", + "Date" : "Mon, 29 Jun 2020 19:45:39 GMT", + "x-ms-client-request-id" : "cd9e8401-5b30-4b19-bbc9-091c4528fca5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes1249039482debd86814bbeaec3?prefix=javablobreadattributes37757417d0194ecbdb478e9&delimiter=/&maxresults=2&include=metadata&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "48c186ed-4b55-4cfa-9111-444453749b4c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2f1a627b-601e-0086-4f4d-4e0006000000", + "Body" : "javablobreadattributes37757417d0194ecbdb478e92/", + "Date" : "Mon, 29 Jun 2020 19:45:40 GMT", + "x-ms-client-request-id" : "48c186ed-4b55-4cfa-9111-444453749b4c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes1249039482debd86814bbeaec3/javablobreadattributes37757417d0194ecbdb478e9", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "0ebb452e-b3aa-4982-a5cd-848ebe3a3b1a", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "AAAAAAAAAAA=", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:45:39 GMT", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "ETag" : "0x8D81C6500E329DF", + "Content-Length" : "0", + "x-ms-request-id" : "33a59dec-201e-00a8-0f4d-4e80c1000000", + "x-ms-client-request-id" : "0ebb452e-b3aa-4982-a5cd-848ebe3a3b1a" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes1249039482debd86814bbeaec3/javablobreadattributes37757417d0194ecbdb478e9", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "8995a16f-7749-46d5-b538-1943c8e0a133" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:40 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:45:40 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "0x8D81C6500E329DF", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:45:40 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "1b7f9427-201e-00a3-2c4d-4e98b5000000", + "x-ms-client-request-id" : "8995a16f-7749-46d5-b538-1943c8e0a133", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcreadattributes&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "2b35bb39-2197-40c2-a127-3ec2eff93a17" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b459d9cb-901e-013d-634d-4ea7a7000000", + "Body" : "jtcreadattributesjtcreadattributes1249039482debd86814bbeaec3Mon, 29 Jun 2020 19:45:39 GMT\"0x8D81C6500814B57\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcreadattributes2336411fa00cf302254d739da4Mon, 29 Jun 2020 19:45:40 GMT\"0x8D81C6500B47482\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:45:40 GMT", + "x-ms-client-request-id" : "2b35bb39-2197-40c2-a127-3ec2eff93a17", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes1249039482debd86814bbeaec3?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "444d63b1-2b24-4f83-8741-393dee6974c8" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ca18bbb-e01e-00d3-764d-4eeb71000000", + "Date" : "Mon, 29 Jun 2020 19:45:40 GMT", + "x-ms-client-request-id" : "444d63b1-2b24-4f83-8741-393dee6974c8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributes2336411fa00cf302254d739da4?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "8f3904fe-e4b6-40d9-ab3f-27332c9606cf" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "79fb9928-b01e-00e2-1c4d-4eb0a6000000", + "Date" : "Mon, 29 Jun 2020 19:45:41 GMT", + "x-ms-client-request-id" : "8f3904fe-e4b6-40d9-ab3f-27332c9606cf" + }, + "Exception" : null + } ], + "variables" : [ "jtcreadattributes002837e88f0423c88d40d48faf", "jtcreadattributes1249039482debd86814bbeaec3", "jtcreadattributes2336411fa00cf302254d739da4", "javablobreadattributes37757417d0194ecbdb478e9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesdirectory.json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesdirectory.json new file mode 100644 index 000000000000..6c51f7999441 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesdirectory.json @@ -0,0 +1,204 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesdirectory162437360ab1310d42475?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "7e7d43bd-3d74-4904-9294-50462edaf1e5" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "b9b81df8-e01e-0014-2f4d-4e97b0000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:b9b81df8-e01e-0014-2f4d-4e97b0000000\nTime:2020-06-29T19:45:41.3119277Z", + "Date" : "Mon, 29 Jun 2020 19:45:40 GMT", + "x-ms-client-request-id" : "7e7d43bd-3d74-4904-9294-50462edaf1e5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesdirectory162437360ab1310d42475?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "9d194481-2242-4bd1-8a5d-5136286e2b97" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C650175B149", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "59d8b0b8-e01e-0036-5d4d-4ef986000000", + "Date" : "Mon, 29 Jun 2020 19:45:41 GMT", + "x-ms-client-request-id" : "9d194481-2242-4bd1-8a5d-5136286e2b97" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesdirectory27186960f0a7d13bab4d8?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "e52a9c9e-cf58-4f73-8df3-8f18bd1cb3be" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "3bd7dfcb-201e-0081-3b4d-4ef683000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:3bd7dfcb-201e-0081-3b4d-4ef683000000\nTime:2020-06-29T19:45:41.7794948Z", + "Date" : "Mon, 29 Jun 2020 19:45:41 GMT", + "x-ms-client-request-id" : "e52a9c9e-cf58-4f73-8df3-8f18bd1cb3be", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesdirectory27186960f0a7d13bab4d8?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "7c073c45-8783-4b1e-b0d4-35fac081b0a4" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6501BEDDDE", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "30e3af5e-301e-00b7-444d-4e5bd1000000", + "Date" : "Mon, 29 Jun 2020 19:45:41 GMT", + "x-ms-client-request-id" : "7c073c45-8783-4b1e-b0d4-35fac081b0a4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesdirectory162437360ab1310d42475/javablobreadattributesdirectory327075ca52baf00cc14?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "3c5e983e-7e58-4698-8f91-1a80d1dba2e2", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6501D72D28", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "40a34408-801e-0026-594d-4ecf60000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:45:42 GMT", + "x-ms-client-request-id" : "3c5e983e-7e58-4698-8f91-1a80d1dba2e2" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesdirectory162437360ab1310d42475/javablobreadattributesdirectory327075ca52baf00cc14", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "c575a2a1-9201-451e-acfc-976f794c67a7" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:42 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:45:42 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-meta-hdi_isfolder" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "0x8D81C6501D72D28", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:45:42 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "68597a5a-201e-0020-2b4d-4e3818000000", + "x-ms-client-request-id" : "c575a2a1-9201-451e-acfc-976f794c67a7", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcreadattributesdirectory&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "98a569fc-e9cb-45ee-983b-be8d52edc3ef" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2b70da53-901e-00ba-354d-4eb4dd000000", + "Body" : "jtcreadattributesdirectoryjtcreadattributesdirectory162437360ab1310d42475Mon, 29 Jun 2020 19:45:41 GMT\"0x8D81C650175B149\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcreadattributesdirectory27186960f0a7d13bab4d8Mon, 29 Jun 2020 19:45:41 GMT\"0x8D81C6501BEDDDE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:45:42 GMT", + "x-ms-client-request-id" : "98a569fc-e9cb-45ee-983b-be8d52edc3ef", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesdirectory162437360ab1310d42475?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "f30b7b92-f6fc-4d04-bbd2-92911d2a4077" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "4353650a-301e-0119-2f4d-4e3ee9000000", + "Date" : "Mon, 29 Jun 2020 19:45:41 GMT", + "x-ms-client-request-id" : "f30b7b92-f6fc-4d04-bbd2-92911d2a4077" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesdirectory27186960f0a7d13bab4d8?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "6a01d731-4643-4c89-a7ee-0c2f51a2a339" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "50338e76-101e-0023-714d-4e3b1f000000", + "Date" : "Mon, 29 Jun 2020 19:45:41 GMT", + "x-ms-client-request-id" : "6a01d731-4643-4c89-a7ee-0c2f51a2a339" + }, + "Exception" : null + } ], + "variables" : [ "jtcreadattributesdirectory05749974cef0f23e5a463", "jtcreadattributesdirectory162437360ab1310d42475", "jtcreadattributesdirectory27186960f0a7d13bab4d8", "javablobreadattributesdirectory327075ca52baf00cc14" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesioexception.json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesioexception.json new file mode 100644 index 000000000000..52fd0b8c70e7 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesioexception.json @@ -0,0 +1,168 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesioexception1645772aa59e3137fe49?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "8b159379-fd00-4224-839d-70f3e2dc60a1" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "11dd51d8-001e-001e-554d-4e8e39000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:11dd51d8-001e-001e-554d-4e8e39000000\nTime:2020-06-29T19:45:44.0362766Z", + "Date" : "Mon, 29 Jun 2020 19:45:43 GMT", + "x-ms-client-request-id" : "8b159379-fd00-4224-839d-70f3e2dc60a1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesioexception1645772aa59e3137fe49?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "7c043cc0-298e-49d7-9798-1f0dc1efe7bb" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C65031402B8", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9c39190e-701e-00f4-344d-4e7138000000", + "Date" : "Mon, 29 Jun 2020 19:45:43 GMT", + "x-ms-client-request-id" : "7c043cc0-298e-49d7-9798-1f0dc1efe7bb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesioexception2146718c5b5586c54347?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "d120c6d0-6b04-4860-bd10-655db57ca6df" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "3ec94882-601e-0063-2a4d-4e12f1000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:3ec94882-601e-0063-2a4d-4e12f1000000\nTime:2020-06-29T19:45:44.3361724Z", + "Date" : "Mon, 29 Jun 2020 19:45:43 GMT", + "x-ms-client-request-id" : "d120c6d0-6b04-4860-bd10-655db57ca6df", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesioexception2146718c5b5586c54347?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "a3e3e72c-9c9d-4972-8db3-a10cc1ce73ae" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C650344176F", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ef34da3c-401e-00d5-6f4d-4e1c09000000", + "Date" : "Mon, 29 Jun 2020 19:45:43 GMT", + "x-ms-client-request-id" : "a3e3e72c-9c9d-4972-8db3-a10cc1ce73ae" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesioexception1645772aa59e3137fe49/path", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "44a8b5d2-67fe-417c-8b26-9f59f4edc7c5" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "BlobNotFound", + "retry-after" : "0", + "StatusCode" : "404", + "x-ms-request-id" : "8d8857f6-c01e-0080-014d-4ef77e000000", + "Date" : "Mon, 29 Jun 2020 19:45:44 GMT", + "x-ms-client-request-id" : "44a8b5d2-67fe-417c-8b26-9f59f4edc7c5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcreadattributesioexception&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "e0d1c4e1-d01a-41f4-831f-cd44b78e66bc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "45c1fe3b-301e-0052-194d-4e4926000000", + "Body" : "jtcreadattributesioexceptionjtcreadattributesioexception1645772aa59e3137fe49Mon, 29 Jun 2020 19:45:44 GMT\"0x8D81C65031402B8\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcreadattributesioexception2146718c5b5586c54347Mon, 29 Jun 2020 19:45:44 GMT\"0x8D81C650344176F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:45:44 GMT", + "x-ms-client-request-id" : "e0d1c4e1-d01a-41f4-831f-cd44b78e66bc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesioexception1645772aa59e3137fe49?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "2706d3f4-fa84-47a4-a2c4-a64786c1512a" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ff35b983-f01e-0088-7e4d-4eec0d000000", + "Date" : "Mon, 29 Jun 2020 19:45:44 GMT", + "x-ms-client-request-id" : "2706d3f4-fa84-47a4-a2c4-a64786c1512a" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesioexception2146718c5b5586c54347?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "998e9ddd-50e1-44f0-a6d7-bd73ac0b5b22" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ba026985-001e-00fb-794d-4e9cce000000", + "Date" : "Mon, 29 Jun 2020 19:45:44 GMT", + "x-ms-client-request-id" : "998e9ddd-50e1-44f0-a6d7-bd73ac0b5b22" + }, + "Exception" : null + } ], + "variables" : [ "jtcreadattributesioexception034559c3dc66b8a10646", "jtcreadattributesioexception1645772aa59e3137fe49", "jtcreadattributesioexception2146718c5b5586c54347" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrdirectory.json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrdirectory.json new file mode 100644 index 000000000000..c01f9630e6ea --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrdirectory.json @@ -0,0 +1,204 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrdirectory1288954a09bcd8e8dd43?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "20e5688a-8a18-46e3-9be3-57791e02321c" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "565222fd-301e-013b-484d-4e50df000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:565222fd-301e-013b-484d-4e50df000000\nTime:2020-06-29T19:46:00.1386865Z", + "Date" : "Mon, 29 Jun 2020 19:46:00 GMT", + "x-ms-client-request-id" : "20e5688a-8a18-46e3-9be3-57791e02321c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrdirectory1288954a09bcd8e8dd43?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "be90cec9-c2d2-4277-8434-64b113831c90" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C650CAF4F5D", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "fe3da62c-301e-0059-0f4d-4e5152000000", + "Date" : "Mon, 29 Jun 2020 19:46:00 GMT", + "x-ms-client-request-id" : "be90cec9-c2d2-4277-8434-64b113831c90" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrdirectory258201710c9c2e59554c?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "89582767-41f0-403d-ab96-ffd2b7bcb10d" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "1206af24-801e-0004-284d-4ea156000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:1206af24-801e-0004-284d-4ea156000000\nTime:2020-06-29T19:46:00.4566065Z", + "Date" : "Mon, 29 Jun 2020 19:45:59 GMT", + "x-ms-client-request-id" : "89582767-41f0-403d-ab96-ffd2b7bcb10d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrdirectory258201710c9c2e59554c?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "bd31e406-1de4-4958-8bbe-b52886c6384d" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C650CDE708A", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "018590b4-801e-0062-324d-4e130c000000", + "Date" : "Mon, 29 Jun 2020 19:46:00 GMT", + "x-ms-client-request-id" : "bd31e406-1de4-4958-8bbe-b52886c6384d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrdirectory1288954a09bcd8e8dd43/javablobreadattributesstrdirectory391788216c5da8933?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "108313bb-7a2b-4367-9b35-6cb5f4810ba2", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C650D00C79D", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0d3d1dae-b01e-000c-644d-4eba25000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:46:00 GMT", + "x-ms-client-request-id" : "108313bb-7a2b-4367-9b35-6cb5f4810ba2" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrdirectory1288954a09bcd8e8dd43/javablobreadattributesstrdirectory391788216c5da8933", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "1f0b4f4d-4603-4f08-95d4-dd3b20cef7fa" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:00 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:46:00 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-meta-hdi_isfolder" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "0x8D81C650D00C79D", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:46:00 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "837d4c67-501e-002f-144d-4ed5ee000000", + "x-ms-client-request-id" : "1f0b4f4d-4603-4f08-95d4-dd3b20cef7fa", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcreadattributesstrdirectory&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "729f161e-20e2-46c6-82b3-37a45bf77713" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "81f3ce43-e01e-003d-0b4d-4ee1f2000000", + "Body" : "jtcreadattributesstrdirectoryjtcreadattributesstrdirectory1288954a09bcd8e8dd43Mon, 29 Jun 2020 19:46:00 GMT\"0x8D81C650CAF4F5D\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcreadattributesstrdirectory258201710c9c2e59554cMon, 29 Jun 2020 19:46:00 GMT\"0x8D81C650CDE708A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:46:00 GMT", + "x-ms-client-request-id" : "729f161e-20e2-46c6-82b3-37a45bf77713", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrdirectory1288954a09bcd8e8dd43?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "f6058650-4153-4f82-be6a-9e771d602241" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "94ad1887-801e-0087-804d-4e01fb000000", + "Date" : "Mon, 29 Jun 2020 19:46:00 GMT", + "x-ms-client-request-id" : "f6058650-4153-4f82-be6a-9e771d602241" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrdirectory258201710c9c2e59554c?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "57d9931d-79eb-4307-a970-3102bf6c8f6c" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "5cc003d5-901e-0114-654d-4ed1e5000000", + "Date" : "Mon, 29 Jun 2020 19:46:00 GMT", + "x-ms-client-request-id" : "57d9931d-79eb-4307-a970-3102bf6c8f6c" + }, + "Exception" : null + } ], + "variables" : [ "jtcreadattributesstrdirectory054503ad87649db68d4f", "jtcreadattributesstrdirectory1288954a09bcd8e8dd43", "jtcreadattributesstrdirectory258201710c9c2e59554c", "javablobreadattributesstrdirectory391788216c5da8933" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstria[0].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstria[0].json new file mode 100644 index 000000000000..c7872046b065 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstria[0].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstria1063257e4e44d5fe5d4204a?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "8eb3d0f3-ebc8-4e0a-bf3e-a4913bfc0afa" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "7f542411-f01e-010f-414d-4eff77000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:7f542411-f01e-010f-414d-4eff77000000\nTime:2020-06-29T19:46:01.6479718Z", + "Date" : "Mon, 29 Jun 2020 19:46:01 GMT", + "x-ms-client-request-id" : "8eb3d0f3-ebc8-4e0a-bf3e-a4913bfc0afa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstria1063257e4e44d5fe5d4204a?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "5b1a134c-f594-4fe7-8670-b7cecb51331f" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C650D9560F3", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "dbf768e9-401e-0091-5f4d-4ec065000000", + "Date" : "Mon, 29 Jun 2020 19:46:01 GMT", + "x-ms-client-request-id" : "5b1a134c-f594-4fe7-8670-b7cecb51331f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstria2255822cba2dc284d845ee8?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "75d6dbd2-453d-4064-9db5-ffd760f80ae8" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "970ec66a-401e-013f-5e4d-4ea55d000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:970ec66a-401e-013f-5e4d-4ea55d000000\nTime:2020-06-29T19:46:01.9811699Z", + "Date" : "Mon, 29 Jun 2020 19:46:01 GMT", + "x-ms-client-request-id" : "75d6dbd2-453d-4064-9db5-ffd760f80ae8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstria2255822cba2dc284d845ee8?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "68088a83-2830-421f-9abd-95431d35dc0a" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C650DC71747", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0b5c4108-501e-0085-664d-4e0301000000", + "Date" : "Mon, 29 Jun 2020 19:46:01 GMT", + "x-ms-client-request-id" : "68088a83-2830-421f-9abd-95431d35dc0a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcreadattributesstria&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "e410daa0-b9d5-4c23-9911-6df946008abe" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0317e4e9-101e-00e4-664d-4e47de000000", + "Body" : "jtcreadattributesstriajtcreadattributesstria1063257e4e44d5fe5d4204aMon, 29 Jun 2020 19:46:01 GMT\"0x8D81C650D9560F3\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcreadattributesstria2255822cba2dc284d845ee8Mon, 29 Jun 2020 19:46:02 GMT\"0x8D81C650DC71747\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:46:02 GMT", + "x-ms-client-request-id" : "e410daa0-b9d5-4c23-9911-6df946008abe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstria1063257e4e44d5fe5d4204a?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "4c5ba2bd-1478-4381-94ae-baef847e4296" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "7053979e-301e-0016-0f4d-4e954a000000", + "Date" : "Mon, 29 Jun 2020 19:46:02 GMT", + "x-ms-client-request-id" : "4c5ba2bd-1478-4381-94ae-baef847e4296" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstria2255822cba2dc284d845ee8?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "564803e8-d76c-489b-882c-e0b44e6b602d" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0f5c0d7a-b01e-0025-044d-4ecc67000000", + "Date" : "Mon, 29 Jun 2020 19:46:02 GMT", + "x-ms-client-request-id" : "564803e8-d76c-489b-882c-e0b44e6b602d" + }, + "Exception" : null + } ], + "variables" : [ "jtcreadattributesstria03801473cad8121c064f358", "jtcreadattributesstria1063257e4e44d5fe5d4204a", "jtcreadattributesstria2255822cba2dc284d845ee8", "javablobreadattributesstria3174865accc9ffb1264d3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstria[1].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstria[1].json new file mode 100644 index 000000000000..d20e48ff2eac --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstria[1].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstria122127a643a84684ea488ab?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "0f437c6c-8b0b-4253-a823-64b446b5a1dd" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "b6714767-701e-0033-7d4d-4e0df9000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:b6714767-701e-0033-7d4d-4e0df9000000\nTime:2020-06-29T19:46:02.8418164Z", + "Date" : "Mon, 29 Jun 2020 19:46:01 GMT", + "x-ms-client-request-id" : "0f437c6c-8b0b-4253-a823-64b446b5a1dd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstria122127a643a84684ea488ab?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "1e5a6fd7-e458-454d-ba04-f0485a3fe7c8" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C650E494FDC", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "79e48092-101e-00cd-4d4d-4e319c000000", + "Date" : "Mon, 29 Jun 2020 19:46:02 GMT", + "x-ms-client-request-id" : "1e5a6fd7-e458-454d-ba04-f0485a3fe7c8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstria213211dbb6827b3f7644148?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "371b1314-4d25-4f47-87e8-4b858a2f38b4" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "e4297890-e01e-0050-364d-4e4bdc000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:e4297890-e01e-0050-364d-4e4bdc000000\nTime:2020-06-29T19:46:03.1775361Z", + "Date" : "Mon, 29 Jun 2020 19:46:03 GMT", + "x-ms-client-request-id" : "371b1314-4d25-4f47-87e8-4b858a2f38b4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstria213211dbb6827b3f7644148?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "5b9087ca-2a29-40e4-8402-685a93fd55fd" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C650E802AA0", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7391d095-e01e-0072-334d-4e25ea000000", + "Date" : "Mon, 29 Jun 2020 19:46:02 GMT", + "x-ms-client-request-id" : "5b9087ca-2a29-40e4-8402-685a93fd55fd" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcreadattributesstria&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "cda3221c-365c-4360-ada0-d2000e1b2aa8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c9a3b711-d01e-00bd-464d-4e4258000000", + "Body" : "jtcreadattributesstriajtcreadattributesstria122127a643a84684ea488abMon, 29 Jun 2020 19:46:02 GMT\"0x8D81C650E494FDC\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcreadattributesstria213211dbb6827b3f7644148Mon, 29 Jun 2020 19:46:03 GMT\"0x8D81C650E802AA0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:46:03 GMT", + "x-ms-client-request-id" : "cda3221c-365c-4360-ada0-d2000e1b2aa8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstria122127a643a84684ea488ab?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "91425939-e86e-48f6-a1a1-648d27cffd04" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9c24674a-201e-002b-764d-4e206c000000", + "Date" : "Mon, 29 Jun 2020 19:46:03 GMT", + "x-ms-client-request-id" : "91425939-e86e-48f6-a1a1-648d27cffd04" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstria213211dbb6827b3f7644148?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "b16b1a20-abd0-466b-8d4c-4544c86d255e" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "fdbd510a-b01e-0061-584d-4e100b000000", + "Date" : "Mon, 29 Jun 2020 19:46:03 GMT", + "x-ms-client-request-id" : "b16b1a20-abd0-466b-8d4c-4544c86d255e" + }, + "Exception" : null + } ], + "variables" : [ "jtcreadattributesstria030767f48d0b5856cf4c9db", "jtcreadattributesstria122127a643a84684ea488ab", "jtcreadattributesstria213211dbb6827b3f7644148", "javablobreadattributesstria3099491e6b18c72e704d9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstria[2].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstria[2].json new file mode 100644 index 000000000000..28ff87721f21 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstria[2].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstria101057ca8847ea7734413fb?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "ab94dda3-33d4-4fcc-9555-ca5ca9647449" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "3d033f35-301e-0034-3a4d-4efb7c000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:3d033f35-301e-0034-3a4d-4efb7c000000\nTime:2020-06-29T19:46:03.9901542Z", + "Date" : "Mon, 29 Jun 2020 19:46:03 GMT", + "x-ms-client-request-id" : "ab94dda3-33d4-4fcc-9555-ca5ca9647449", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstria101057ca8847ea7734413fb?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "1d3f809c-35b9-4176-908e-42c1e1a6845c" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C650EF9E2D2", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "3fd19be6-b01e-006a-214d-4e087f000000", + "Date" : "Mon, 29 Jun 2020 19:46:03 GMT", + "x-ms-client-request-id" : "1d3f809c-35b9-4176-908e-42c1e1a6845c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstria204232aa0cee27e7874599a?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "ef68eb25-55e8-4063-8f0f-1b57bffb450b" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "f174ad8f-d01e-0118-054d-4e3f14000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:f174ad8f-d01e-0118-054d-4e3f14000000\nTime:2020-06-29T19:46:04.3008958Z", + "Date" : "Mon, 29 Jun 2020 19:46:03 GMT", + "x-ms-client-request-id" : "ef68eb25-55e8-4063-8f0f-1b57bffb450b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstria204232aa0cee27e7874599a?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "c2d536d8-291b-46b0-941d-b0fa116a50d8" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C650F2BEFEE", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "89c224ee-001e-0037-484d-4ef87b000000", + "Date" : "Mon, 29 Jun 2020 19:46:04 GMT", + "x-ms-client-request-id" : "c2d536d8-291b-46b0-941d-b0fa116a50d8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcreadattributesstria&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "174f64eb-3bdb-45e1-8aa7-3487931f16af" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cad683bc-201e-010d-424d-4efd8d000000", + "Body" : "jtcreadattributesstriajtcreadattributesstria101057ca8847ea7734413fbMon, 29 Jun 2020 19:46:04 GMT\"0x8D81C650EF9E2D2\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcreadattributesstria204232aa0cee27e7874599aMon, 29 Jun 2020 19:46:04 GMT\"0x8D81C650F2BEFEE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:46:04 GMT", + "x-ms-client-request-id" : "174f64eb-3bdb-45e1-8aa7-3487931f16af", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstria101057ca8847ea7734413fb?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "71ef133f-a485-415f-abf4-83a8c5b625de" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "fc6e357e-a01e-0090-1c4d-4ec198000000", + "Date" : "Mon, 29 Jun 2020 19:46:04 GMT", + "x-ms-client-request-id" : "71ef133f-a485-415f-abf4-83a8c5b625de" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstria204232aa0cee27e7874599a?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "a5159cae-5498-4296-a9c7-7c5fa50dfdbd" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "52fca39d-a01e-003a-4c4d-4e1777000000", + "Date" : "Mon, 29 Jun 2020 19:46:04 GMT", + "x-ms-client-request-id" : "a5159cae-5498-4296-a9c7-7c5fa50dfdbd" + }, + "Exception" : null + } ], + "variables" : [ "jtcreadattributesstria0559611e5910f7ff6f48cbb", "jtcreadattributesstria101057ca8847ea7734413fb", "jtcreadattributesstria204232aa0cee27e7874599a", "javablobreadattributesstria3270706fecab428fb84e4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrinvalidview.json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrinvalidview.json new file mode 100644 index 000000000000..1419e225bc53 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrinvalidview.json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrinvalidview1268437afbbc40b1784?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "698a651e-9ec0-4273-9898-2490ab55969b" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "af9d43f8-501e-00ac-0d4d-4e7543000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:af9d43f8-501e-00ac-0d4d-4e7543000000\nTime:2020-06-29T19:46:05.1177092Z", + "Date" : "Mon, 29 Jun 2020 19:46:04 GMT", + "x-ms-client-request-id" : "698a651e-9ec0-4273-9898-2490ab55969b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrinvalidview1268437afbbc40b1784?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "00099c01-569b-4534-b5a0-29ff30bef8b1" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C650FA50D80", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "fc46908b-a01e-0057-764d-4ebd59000000", + "Date" : "Mon, 29 Jun 2020 19:46:05 GMT", + "x-ms-client-request-id" : "00099c01-569b-4534-b5a0-29ff30bef8b1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrinvalidview214629e2fad2cfcef34?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "e8e0a70d-17f1-453c-9265-7b4ec4e10e76" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "02d29d5e-f01e-012d-354d-4e9141000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:02d29d5e-f01e-012d-354d-4e9141000000\nTime:2020-06-29T19:46:05.4201804Z", + "Date" : "Mon, 29 Jun 2020 19:46:05 GMT", + "x-ms-client-request-id" : "e8e0a70d-17f1-453c-9265-7b4ec4e10e76", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrinvalidview214629e2fad2cfcef34?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "6737f5ed-9fef-48c7-b936-bf68f8f14109" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C650FD4F916", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ce8eadff-801e-000f-774d-4eb922000000", + "Date" : "Mon, 29 Jun 2020 19:46:05 GMT", + "x-ms-client-request-id" : "6737f5ed-9fef-48c7-b936-bf68f8f14109" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcreadattributesstrinvalidview&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "3fcbe570-b9c6-4678-87e9-545d902e6d22" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "bbd9111a-e01e-00be-804d-4e415f000000", + "Body" : "jtcreadattributesstrinvalidviewjtcreadattributesstrinvalidview1268437afbbc40b1784Mon, 29 Jun 2020 19:46:05 GMT\"0x8D81C650FA50D80\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcreadattributesstrinvalidview214629e2fad2cfcef34Mon, 29 Jun 2020 19:46:05 GMT\"0x8D81C650FD4F916\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:46:04 GMT", + "x-ms-client-request-id" : "3fcbe570-b9c6-4678-87e9-545d902e6d22", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrinvalidview1268437afbbc40b1784?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "15548c2c-c779-4060-a620-eb86bad04fb5" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "55e794f3-a01e-0018-684d-4e7941000000", + "Date" : "Mon, 29 Jun 2020 19:46:05 GMT", + "x-ms-client-request-id" : "15548c2c-c779-4060-a620-eb86bad04fb5" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrinvalidview214629e2fad2cfcef34?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "8858ecd6-a113-45b2-a387-974be40edaf7" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "6501e0ac-b01e-012a-664d-4e67c4000000", + "Date" : "Mon, 29 Jun 2020 19:46:05 GMT", + "x-ms-client-request-id" : "8858ecd6-a113-45b2-a387-974be40edaf7" + }, + "Exception" : null + } ], + "variables" : [ "jtcreadattributesstrinvalidview043222224583d43f824", "jtcreadattributesstrinvalidview1268437afbbc40b1784", "jtcreadattributesstrinvalidview214629e2fad2cfcef34", "javablobreadattributesstrinvalidview3096368095bd22cf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrioexception.json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrioexception.json new file mode 100644 index 000000000000..602c82aa1fd0 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrioexception.json @@ -0,0 +1,168 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrioexception11836991ef307f61714?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "6a95aa2b-0c7d-4bf9-9ce2-8decb3f9f916" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "5c61dd58-701e-0099-6a4d-4edb16000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:5c61dd58-701e-0099-6a4d-4edb16000000\nTime:2020-06-29T19:46:06.1998142Z", + "Date" : "Mon, 29 Jun 2020 19:46:05 GMT", + "x-ms-client-request-id" : "6a95aa2b-0c7d-4bf9-9ce2-8decb3f9f916", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrioexception11836991ef307f61714?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "cfbf51e6-e270-4c0f-8cba-34270e3ba7ac" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C65104A5778", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "fff86a37-901e-001b-284d-4e7a46000000", + "Date" : "Mon, 29 Jun 2020 19:46:05 GMT", + "x-ms-client-request-id" : "cfbf51e6-e270-4c0f-8cba-34270e3ba7ac" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrioexception2208528d849c033c194?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "6712417e-7626-4c31-a8a2-055508eb1016" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "178dae0c-201e-0002-294d-4e562e000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:178dae0c-201e-0002-294d-4e562e000000\nTime:2020-06-29T19:46:06.5040571Z", + "Date" : "Mon, 29 Jun 2020 19:46:05 GMT", + "x-ms-client-request-id" : "6712417e-7626-4c31-a8a2-055508eb1016", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrioexception2208528d849c033c194?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "b6ba9532-244b-4ff6-b847-2b2a331a977e" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C65107943D2", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "97b9c603-401e-0074-024d-4ed292000000", + "Date" : "Mon, 29 Jun 2020 19:46:06 GMT", + "x-ms-client-request-id" : "b6ba9532-244b-4ff6-b847-2b2a331a977e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrioexception11836991ef307f61714/path", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "d93ec05d-25c5-4faa-8575-c05f766bc270" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "BlobNotFound", + "retry-after" : "0", + "StatusCode" : "404", + "x-ms-request-id" : "605823a0-c01e-006e-6a4d-4efdfd000000", + "Date" : "Mon, 29 Jun 2020 19:46:06 GMT", + "x-ms-client-request-id" : "d93ec05d-25c5-4faa-8575-c05f766bc270" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcreadattributesstrioexception&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "a4a3fbf4-d522-43a5-9707-87ac1e198caf" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "76b9ae6f-801e-002d-254d-4ed714000000", + "Body" : "jtcreadattributesstrioexceptionjtcreadattributesstrioexception11836991ef307f61714Mon, 29 Jun 2020 19:46:06 GMT\"0x8D81C65104A5778\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcreadattributesstrioexception2208528d849c033c194Mon, 29 Jun 2020 19:46:06 GMT\"0x8D81C65107943D2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:46:06 GMT", + "x-ms-client-request-id" : "a4a3fbf4-d522-43a5-9707-87ac1e198caf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrioexception11836991ef307f61714?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "fadb441d-cc5c-4ac0-b7c4-8190ad15c993" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0f5320ad-a01e-0013-4d4d-4e6135000000", + "Date" : "Mon, 29 Jun 2020 19:46:06 GMT", + "x-ms-client-request-id" : "fadb441d-cc5c-4ac0-b7c4-8190ad15c993" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrioexception2208528d849c033c194?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "6ae3ef8b-61c8-4dbc-8033-58db9dfed3d1" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "1f3f41f7-501e-000d-6f4d-4ebbd8000000", + "Date" : "Mon, 29 Jun 2020 19:46:06 GMT", + "x-ms-client-request-id" : "6ae3ef8b-61c8-4dbc-8033-58db9dfed3d1" + }, + "Exception" : null + } ], + "variables" : [ "jtcreadattributesstrioexception04135470eda43b8f984", "jtcreadattributesstrioexception11836991ef307f61714", "jtcreadattributesstrioexception2208528d849c033c194" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrparsing[0].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrparsing[0].json new file mode 100644 index 000000000000..a10f381105b6 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrparsing[0].json @@ -0,0 +1,226 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing1599825bbe9ce55c12422?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "05933fa5-1d3b-498c-8b9f-c6fb68feaf9f" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "718b90fd-801e-0069-194d-4e0b78000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:718b90fd-801e-0069-194d-4e0b78000000\nTime:2020-06-29T19:45:45.2854397Z", + "Date" : "Mon, 29 Jun 2020 19:45:44 GMT", + "x-ms-client-request-id" : "05933fa5-1d3b-498c-8b9f-c6fb68feaf9f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing1599825bbe9ce55c12422?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "7b728e47-e0ea-4186-8140-e0d962c49f3d" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6503D73609", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "81d20bd3-701e-0077-524d-4ed195000000", + "Date" : "Mon, 29 Jun 2020 19:45:45 GMT", + "x-ms-client-request-id" : "7b728e47-e0ea-4186-8140-e0d962c49f3d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing27031942a3041d9cbb4de?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "d7de70ab-4aec-4902-9a48-b6bbdc979bc7" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "adabe838-601e-00c2-144d-4edc6a000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:adabe838-601e-00c2-144d-4edc6a000000\nTime:2020-06-29T19:45:45.6263562Z", + "Date" : "Mon, 29 Jun 2020 19:45:45 GMT", + "x-ms-client-request-id" : "d7de70ab-4aec-4902-9a48-b6bbdc979bc7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing27031942a3041d9cbb4de?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "6155a69f-4533-45b5-84c8-29d6808f47c5" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C65040A8320", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0817200e-501e-0120-174d-4e7e4d000000", + "Date" : "Mon, 29 Jun 2020 19:45:45 GMT", + "x-ms-client-request-id" : "6155a69f-4533-45b5-84c8-29d6808f47c5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing1599825bbe9ce55c12422?prefix=javablobreadattributesstrparsing33406094c10292fdc8&delimiter=/&maxresults=2&include=metadata&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "d1fc373c-52ee-4f33-8d30-59c940bd8e65" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "5dc8087d-201e-012f-174d-4e93bb000000", + "Body" : "javablobreadattributesstrparsing33406094c10292fdc82/", + "Date" : "Mon, 29 Jun 2020 19:45:45 GMT", + "x-ms-client-request-id" : "d1fc373c-52ee-4f33-8d30-59c940bd8e65", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing1599825bbe9ce55c12422/javablobreadattributesstrparsing33406094c10292fdc8", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "a7376577-1e86-45a6-b37a-0799a48d77e8", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "AAAAAAAAAAA=", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:46 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:45:45 GMT", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "ETag" : "0x8D81C65043EDB6A", + "Content-Length" : "0", + "x-ms-request-id" : "b860c49d-201e-00c5-3a4d-4e2aef000000", + "x-ms-client-request-id" : "a7376577-1e86-45a6-b37a-0799a48d77e8" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing1599825bbe9ce55c12422/javablobreadattributesstrparsing33406094c10292fdc8", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "04897224-d8e7-4114-966f-37138727bd5a" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:46 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:45:45 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "0x8D81C65043EDB6A", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:45:46 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "1d82a6f2-101e-00ab-384d-4e83c6000000", + "x-ms-client-request-id" : "04897224-d8e7-4114-966f-37138727bd5a", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcreadattributesstrparsing&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "236ea21f-4424-493f-830e-dbc184f7cd5b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "bc3f8b67-b01e-002e-304d-4ed413000000", + "Body" : "jtcreadattributesstrparsingjtcreadattributesstrparsing1599825bbe9ce55c12422Mon, 29 Jun 2020 19:45:45 GMT\"0x8D81C6503D73609\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcreadattributesstrparsing27031942a3041d9cbb4deMon, 29 Jun 2020 19:45:45 GMT\"0x8D81C65040A8320\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:45:46 GMT", + "x-ms-client-request-id" : "236ea21f-4424-493f-830e-dbc184f7cd5b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing1599825bbe9ce55c12422?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "bff959c1-a15a-47a3-80d3-a0d1442216ec" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "74b6fd8d-801e-00c8-354d-4ec5e3000000", + "Date" : "Mon, 29 Jun 2020 19:45:46 GMT", + "x-ms-client-request-id" : "bff959c1-a15a-47a3-80d3-a0d1442216ec" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing27031942a3041d9cbb4de?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "d83d83f0-b82a-45c7-a79f-22720c7d6081" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0ba9978d-f01e-0126-704d-4e8935000000", + "Date" : "Mon, 29 Jun 2020 19:45:46 GMT", + "x-ms-client-request-id" : "d83d83f0-b82a-45c7-a79f-22720c7d6081" + }, + "Exception" : null + } ], + "variables" : [ "jtcreadattributesstrparsing062721e7ac1272bdaa4af", "jtcreadattributesstrparsing1599825bbe9ce55c12422", "jtcreadattributesstrparsing27031942a3041d9cbb4de", "javablobreadattributesstrparsing33406094c10292fdc8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrparsing[1].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrparsing[1].json new file mode 100644 index 000000000000..d42cd547472d --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrparsing[1].json @@ -0,0 +1,226 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing12464428ddc82da870406?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "71163638-fa80-4f47-bc32-aecdcf3cd6ec" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "dbd2c7c8-301e-0095-804d-4e35e7000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:dbd2c7c8-301e-0095-804d-4e35e7000000\nTime:2020-06-29T19:45:47.0185976Z", + "Date" : "Mon, 29 Jun 2020 19:45:46 GMT", + "x-ms-client-request-id" : "71163638-fa80-4f47-bc32-aecdcf3cd6ec", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing12464428ddc82da870406?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "f0ce797b-8561-433c-bc13-f45f5facc964" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6504DA985F", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "5202a330-b01e-00cb-604d-4ec6e4000000", + "Date" : "Mon, 29 Jun 2020 19:45:46 GMT", + "x-ms-client-request-id" : "f0ce797b-8561-433c-bc13-f45f5facc964" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing233861aa64407f7ae747c?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "508a440e-8a25-4a58-9b7a-2104b557fb58" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "10cdb53a-601e-0101-644d-4e137c000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:10cdb53a-601e-0101-644d-4e137c000000\nTime:2020-06-29T19:45:47.3307274Z", + "Date" : "Mon, 29 Jun 2020 19:45:46 GMT", + "x-ms-client-request-id" : "508a440e-8a25-4a58-9b7a-2104b557fb58", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing233861aa64407f7ae747c?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "f1176cb0-8302-4d58-963b-7fadd29f29ed" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C65050AB4CF", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "718c3cc4-301e-0070-5a4d-4e2710000000", + "Date" : "Mon, 29 Jun 2020 19:45:47 GMT", + "x-ms-client-request-id" : "f1176cb0-8302-4d58-963b-7fadd29f29ed" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing12464428ddc82da870406?prefix=javablobreadattributesstrparsing3896495c7f0942432d&delimiter=/&maxresults=2&include=metadata&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "549fc9ae-255e-45eb-b402-92ee430941ed" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9fd291ac-701e-0092-124d-4ec362000000", + "Body" : "javablobreadattributesstrparsing3896495c7f0942432d2/", + "Date" : "Mon, 29 Jun 2020 19:45:46 GMT", + "x-ms-client-request-id" : "549fc9ae-255e-45eb-b402-92ee430941ed", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing12464428ddc82da870406/javablobreadattributesstrparsing3896495c7f0942432d", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "e7616fe0-c5e3-41ea-93e7-23c7357126bf", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "AAAAAAAAAAA=", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:45:47 GMT", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "ETag" : "0x8D81C65053D40FB", + "Content-Length" : "0", + "x-ms-request-id" : "905de893-001e-0051-2e4d-4e4a21000000", + "x-ms-client-request-id" : "e7616fe0-c5e3-41ea-93e7-23c7357126bf" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing12464428ddc82da870406/javablobreadattributesstrparsing3896495c7f0942432d", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "0077dc19-3eba-4b35-91d1-276049803745" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:47 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:45:47 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "0x8D81C65053D40FB", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:45:47 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "e3fff69b-601e-00eb-3a4d-4eaa28000000", + "x-ms-client-request-id" : "0077dc19-3eba-4b35-91d1-276049803745", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcreadattributesstrparsing&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "429c45bd-702a-4dc7-ae18-880aa8b63584" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ef2eb5d-f01e-006d-124d-4efefa000000", + "Body" : "jtcreadattributesstrparsingjtcreadattributesstrparsing12464428ddc82da870406Mon, 29 Jun 2020 19:45:47 GMT\"0x8D81C6504DA985F\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcreadattributesstrparsing233861aa64407f7ae747cMon, 29 Jun 2020 19:45:47 GMT\"0x8D81C65050AB4CF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:45:47 GMT", + "x-ms-client-request-id" : "429c45bd-702a-4dc7-ae18-880aa8b63584", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing12464428ddc82da870406?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "d9eb347c-2560-4d10-b4d8-37d73669b989" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "54ab23b1-601e-0068-624d-4e0a85000000", + "Date" : "Mon, 29 Jun 2020 19:45:48 GMT", + "x-ms-client-request-id" : "d9eb347c-2560-4d10-b4d8-37d73669b989" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing233861aa64407f7ae747c?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "4bf2327b-21cd-47c5-80a6-f98738c55c95" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "830b098b-401e-0116-7d4d-4ed31f000000", + "Date" : "Mon, 29 Jun 2020 19:45:47 GMT", + "x-ms-client-request-id" : "4bf2327b-21cd-47c5-80a6-f98738c55c95" + }, + "Exception" : null + } ], + "variables" : [ "jtcreadattributesstrparsing038408dffeb0759784405", "jtcreadattributesstrparsing12464428ddc82da870406", "jtcreadattributesstrparsing233861aa64407f7ae747c", "javablobreadattributesstrparsing3896495c7f0942432d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrparsing[2].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrparsing[2].json new file mode 100644 index 000000000000..50d4ef598a51 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrparsing[2].json @@ -0,0 +1,226 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing149586db092918bda1457?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "b7f73e74-e66f-4fa6-a14d-a09bb0692966" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "cb00cba2-401e-005d-3a4d-4ea4d0000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:cb00cba2-401e-005d-3a4d-4ea4d0000000\nTime:2020-06-29T19:45:48.7324680Z", + "Date" : "Mon, 29 Jun 2020 19:45:48 GMT", + "x-ms-client-request-id" : "b7f73e74-e66f-4fa6-a14d-a09bb0692966", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing149586db092918bda1457?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "d80e825a-3878-47c9-86ec-28d8d599dcf0" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6505E19B5A", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2e3c772f-901e-0093-0a4d-4ec29f000000", + "Date" : "Mon, 29 Jun 2020 19:45:48 GMT", + "x-ms-client-request-id" : "d80e825a-3878-47c9-86ec-28d8d599dcf0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing216357e08fe9ef94344a6?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "50c69155-760b-4cdc-8b24-fcb8b4940a73" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "d74355b3-101e-0105-3f4d-4ee6fe000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:d74355b3-101e-0105-3f4d-4ee6fe000000\nTime:2020-06-29T19:45:49.0434646Z", + "Date" : "Mon, 29 Jun 2020 19:45:48 GMT", + "x-ms-client-request-id" : "50c69155-760b-4cdc-8b24-fcb8b4940a73", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing216357e08fe9ef94344a6?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "00f7e147-9409-47ba-b104-9d7551a6c2c9" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C650610CA15", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "22053958-601e-0128-5a4d-4e653e000000", + "Date" : "Mon, 29 Jun 2020 19:45:48 GMT", + "x-ms-client-request-id" : "00f7e147-9409-47ba-b104-9d7551a6c2c9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing149586db092918bda1457?prefix=javablobreadattributesstrparsing332083e51890468dfb&delimiter=/&maxresults=2&include=metadata&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "001ca767-23d3-4f97-b618-b26adcde88c3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8a1f0469-901e-0032-264d-4e0c04000000", + "Body" : "javablobreadattributesstrparsing332083e51890468dfb2/", + "Date" : "Mon, 29 Jun 2020 19:45:48 GMT", + "x-ms-client-request-id" : "001ca767-23d3-4f97-b618-b26adcde88c3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing149586db092918bda1457/javablobreadattributesstrparsing332083e51890468dfb", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "b63a2aee-1270-45fa-9368-aaa2c6726a80", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "AAAAAAAAAAA=", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:45:48 GMT", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "ETag" : "0x8D81C650641C1E6", + "Content-Length" : "0", + "x-ms-request-id" : "b3f5007e-b01e-0108-7f4d-4e09f2000000", + "x-ms-client-request-id" : "b63a2aee-1270-45fa-9368-aaa2c6726a80" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing149586db092918bda1457/javablobreadattributesstrparsing332083e51890468dfb", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "5e0f67dc-df73-4e44-b9e3-c542700f4160" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:49 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:45:49 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "0x8D81C650641C1E6", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:45:49 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "12592d92-b01e-0103-714d-4e1186000000", + "x-ms-client-request-id" : "5e0f67dc-df73-4e44-b9e3-c542700f4160", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcreadattributesstrparsing&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "7fa27b2f-c4c6-4a76-9e86-bb035140462a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e8a4b06c-a01e-00fd-2e4d-4e6bb6000000", + "Body" : "jtcreadattributesstrparsingjtcreadattributesstrparsing149586db092918bda1457Mon, 29 Jun 2020 19:45:48 GMT\"0x8D81C6505E19B5A\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcreadattributesstrparsing216357e08fe9ef94344a6Mon, 29 Jun 2020 19:45:49 GMT\"0x8D81C650610CA15\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:45:49 GMT", + "x-ms-client-request-id" : "7fa27b2f-c4c6-4a76-9e86-bb035140462a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing149586db092918bda1457?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "3a0f2524-0ecf-4fe0-8ddb-3cef2651e295" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "fa8da8fe-401e-00f7-604d-4e723f000000", + "Date" : "Mon, 29 Jun 2020 19:45:49 GMT", + "x-ms-client-request-id" : "3a0f2524-0ecf-4fe0-8ddb-3cef2651e295" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing216357e08fe9ef94344a6?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "4deccebd-a849-4a74-abb7-4b796fcf642c" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "71c3463f-d01e-003e-544d-4ee2f5000000", + "Date" : "Mon, 29 Jun 2020 19:45:49 GMT", + "x-ms-client-request-id" : "4deccebd-a849-4a74-abb7-4b796fcf642c" + }, + "Exception" : null + } ], + "variables" : [ "jtcreadattributesstrparsing0923923f1cdcf6c932468", "jtcreadattributesstrparsing149586db092918bda1457", "jtcreadattributesstrparsing216357e08fe9ef94344a6", "javablobreadattributesstrparsing332083e51890468dfb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrparsing[3].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrparsing[3].json new file mode 100644 index 000000000000..25bf6b08262a --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrparsing[3].json @@ -0,0 +1,226 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing16675405bf0ecd64a8495?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "103f0e52-6ce5-4c68-97a9-982cbac0a434" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "6d6fd6d3-e01e-00d8-204d-4ef305000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:6d6fd6d3-e01e-00d8-204d-4ef305000000\nTime:2020-06-29T19:45:50.3425003Z", + "Date" : "Mon, 29 Jun 2020 19:45:50 GMT", + "x-ms-client-request-id" : "103f0e52-6ce5-4c68-97a9-982cbac0a434", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing16675405bf0ecd64a8495?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "ab449581-7934-4046-a0a6-3c7afdc602b0" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6506D6D266", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "69847465-201e-006f-0d4d-4efc00000000", + "Date" : "Mon, 29 Jun 2020 19:45:49 GMT", + "x-ms-client-request-id" : "ab449581-7934-4046-a0a6-3c7afdc602b0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing271835abf5db0fba0946f?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "d126d336-fe24-4847-8f67-178cb9281145" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "974b69e9-601e-0005-4e4d-4ea0ab000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:974b69e9-601e-0005-4e4d-4ea0ab000000\nTime:2020-06-29T19:45:50.6575389Z", + "Date" : "Mon, 29 Jun 2020 19:45:50 GMT", + "x-ms-client-request-id" : "d126d336-fe24-4847-8f67-178cb9281145", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing271835abf5db0fba0946f?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "686c76f3-5c2f-48c9-a557-0aa54fb0097b" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C650708F641", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "4694580c-401e-00b3-494d-4eae53000000", + "Date" : "Mon, 29 Jun 2020 19:45:50 GMT", + "x-ms-client-request-id" : "686c76f3-5c2f-48c9-a557-0aa54fb0097b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing16675405bf0ecd64a8495?prefix=javablobreadattributesstrparsing328094f63c91872f06&delimiter=/&maxresults=2&include=metadata&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "fc657eef-db05-4751-9ca5-b8d0f6606b80" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "04e8dbeb-901e-00fe-214d-4e68b1000000", + "Body" : "javablobreadattributesstrparsing328094f63c91872f062/", + "Date" : "Mon, 29 Jun 2020 19:45:50 GMT", + "x-ms-client-request-id" : "fc657eef-db05-4751-9ca5-b8d0f6606b80", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing16675405bf0ecd64a8495/javablobreadattributesstrparsing328094f63c91872f06", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "92a6af7d-f6ca-4964-aeee-67e847795442", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "AAAAAAAAAAA=", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:45:51 GMT", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "ETag" : "0x8D81C65073B6B5D", + "Content-Length" : "0", + "x-ms-request-id" : "05b4ff47-d01e-0094-764d-4e341a000000", + "x-ms-client-request-id" : "92a6af7d-f6ca-4964-aeee-67e847795442" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing16675405bf0ecd64a8495/javablobreadattributesstrparsing328094f63c91872f06", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "3eaf57c3-0072-4dfa-96a2-5663f397729a" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:51 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:45:50 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "0x8D81C65073B6B5D", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:45:51 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "8b6336ff-d01e-00b6-264d-4e5a2c000000", + "x-ms-client-request-id" : "3eaf57c3-0072-4dfa-96a2-5663f397729a", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcreadattributesstrparsing&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "bc0d52c4-4b57-476f-b311-2028ef228781" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "16f4023c-701e-0011-204d-4e63cf000000", + "Body" : "jtcreadattributesstrparsingjtcreadattributesstrparsing16675405bf0ecd64a8495Mon, 29 Jun 2020 19:45:50 GMT\"0x8D81C6506D6D266\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcreadattributesstrparsing271835abf5db0fba0946fMon, 29 Jun 2020 19:45:50 GMT\"0x8D81C650708F641\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:45:50 GMT", + "x-ms-client-request-id" : "bc0d52c4-4b57-476f-b311-2028ef228781", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing16675405bf0ecd64a8495?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "859de538-e342-4625-817c-8b300fccffc7" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "2b6340ae-001e-00bf-724d-4e40a2000000", + "Date" : "Mon, 29 Jun 2020 19:45:51 GMT", + "x-ms-client-request-id" : "859de538-e342-4625-817c-8b300fccffc7" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing271835abf5db0fba0946f?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "802b3a6a-961f-4ad8-a181-d4385b479be6" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "82f8538f-601e-010a-3c4d-4e0b08000000", + "Date" : "Mon, 29 Jun 2020 19:45:51 GMT", + "x-ms-client-request-id" : "802b3a6a-961f-4ad8-a181-d4385b479be6" + }, + "Exception" : null + } ], + "variables" : [ "jtcreadattributesstrparsing050764d51d97fda8a341c", "jtcreadattributesstrparsing16675405bf0ecd64a8495", "jtcreadattributesstrparsing271835abf5db0fba0946f", "javablobreadattributesstrparsing328094f63c91872f06" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrparsing[4].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrparsing[4].json new file mode 100644 index 000000000000..f7d3032b7312 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrparsing[4].json @@ -0,0 +1,226 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing133804b1153ac902fe497?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "9d2d009e-1d74-4a78-ab85-8763248bd995" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "87607b05-201e-0064-384d-4ee474000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:87607b05-201e-0064-384d-4ee474000000\nTime:2020-06-29T19:45:51.9802102Z", + "Date" : "Mon, 29 Jun 2020 19:45:51 GMT", + "x-ms-client-request-id" : "9d2d009e-1d74-4a78-ab85-8763248bd995", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing133804b1153ac902fe497?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "984e2026-6813-4912-84b3-8a606720849c" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6507D0DE51", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c7b7bc3f-801e-00ae-444d-4e77b9000000", + "Date" : "Mon, 29 Jun 2020 19:45:51 GMT", + "x-ms-client-request-id" : "984e2026-6813-4912-84b3-8a606720849c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing2977318cb3e7517e3947e?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "8b20b8e3-e269-4afa-af17-617d7b409f98" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "7b3e54ef-301e-00d1-7d4d-4ee98b000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:7b3e54ef-301e-00d1-7d4d-4ee98b000000\nTime:2020-06-29T19:45:52.3588220Z", + "Date" : "Mon, 29 Jun 2020 19:45:51 GMT", + "x-ms-client-request-id" : "8b20b8e3-e269-4afa-af17-617d7b409f98", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing2977318cb3e7517e3947e?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "a848b8d3-0227-42e3-b453-4223d4aa2cac" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C65080B1250", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b27fa243-d01e-0053-6a4d-4e48db000000", + "Date" : "Mon, 29 Jun 2020 19:45:52 GMT", + "x-ms-client-request-id" : "a848b8d3-0227-42e3-b453-4223d4aa2cac" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing133804b1153ac902fe497?prefix=javablobreadattributesstrparsing3959986138e04c5c8e&delimiter=/&maxresults=2&include=metadata&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "3f61f556-56d0-4729-9dc8-fadc48a70518" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "7e5a4ea8-001e-00d9-0e4d-4ef2f8000000", + "Body" : "javablobreadattributesstrparsing3959986138e04c5c8e2/", + "Date" : "Mon, 29 Jun 2020 19:45:52 GMT", + "x-ms-client-request-id" : "3f61f556-56d0-4729-9dc8-fadc48a70518", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing133804b1153ac902fe497/javablobreadattributesstrparsing3959986138e04c5c8e", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "9bf3f342-37af-4ea9-a6b0-8f55a4dffb26", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "AAAAAAAAAAA=", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:45:52 GMT", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "ETag" : "0x8D81C65084A008F", + "Content-Length" : "0", + "x-ms-request-id" : "daf113d0-901e-0098-564d-4edaeb000000", + "x-ms-client-request-id" : "9bf3f342-37af-4ea9-a6b0-8f55a4dffb26" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing133804b1153ac902fe497/javablobreadattributesstrparsing3959986138e04c5c8e", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "9b37ac53-b760-41af-a20b-1533eb9dabfd" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:52 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:45:52 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "0x8D81C65084A008F", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:45:52 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "af998795-501e-0006-3b4d-4ea3ac000000", + "x-ms-client-request-id" : "9b37ac53-b760-41af-a20b-1533eb9dabfd", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcreadattributesstrparsing&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "761c8cd2-3ce9-4dff-869c-a0a8b3cacbe7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c7a64da0-101e-0001-354d-4e5529000000", + "Body" : "jtcreadattributesstrparsingjtcreadattributesstrparsing133804b1153ac902fe497Mon, 29 Jun 2020 19:45:52 GMT\"0x8D81C6507D0DE51\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcreadattributesstrparsing2977318cb3e7517e3947eMon, 29 Jun 2020 19:45:52 GMT\"0x8D81C65080B1250\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:45:53 GMT", + "x-ms-client-request-id" : "761c8cd2-3ce9-4dff-869c-a0a8b3cacbe7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing133804b1153ac902fe497?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "5333482d-bf9d-4aaa-918e-177c7d5685bd" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "4aaa45e5-901e-00d7-654d-4e1ef3000000", + "Date" : "Mon, 29 Jun 2020 19:45:52 GMT", + "x-ms-client-request-id" : "5333482d-bf9d-4aaa-918e-177c7d5685bd" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing2977318cb3e7517e3947e?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "bcaea292-6ecd-468a-b2b6-0f5e3f4f348a" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "2b083647-201e-0009-594d-4e4e5a000000", + "Date" : "Mon, 29 Jun 2020 19:45:53 GMT", + "x-ms-client-request-id" : "bcaea292-6ecd-468a-b2b6-0f5e3f4f348a" + }, + "Exception" : null + } ], + "variables" : [ "jtcreadattributesstrparsing058758baa3f357c4c14ef", "jtcreadattributesstrparsing133804b1153ac902fe497", "jtcreadattributesstrparsing2977318cb3e7517e3947e", "javablobreadattributesstrparsing3959986138e04c5c8e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrparsing[5].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrparsing[5].json new file mode 100644 index 000000000000..13aad4e17f73 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrparsing[5].json @@ -0,0 +1,226 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing1200198131a07776d5409?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "d3167a15-9bdd-43dd-98fc-04b091eabcc2" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "7fce459b-601e-00a4-454d-4e6e30000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:7fce459b-601e-00a4-454d-4e6e30000000\nTime:2020-06-29T19:45:54.8036995Z", + "Date" : "Mon, 29 Jun 2020 19:45:54 GMT", + "x-ms-client-request-id" : "d3167a15-9bdd-43dd-98fc-04b091eabcc2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing1200198131a07776d5409?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "6af93c08-8eb9-4be5-ac6b-0f2ad6a7b759" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C65097F4F2F", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f0c66984-a01e-013e-7e4d-4ea4a0000000", + "Date" : "Mon, 29 Jun 2020 19:45:54 GMT", + "x-ms-client-request-id" : "6af93c08-8eb9-4be5-ac6b-0f2ad6a7b759" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing2929762b48d08a9359439?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "79e2f1e1-8d63-4c28-bc01-2d13590bc88c" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "890c4593-e01e-0110-634d-4e2467000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:890c4593-e01e-0110-634d-4e2467000000\nTime:2020-06-29T19:45:55.1348170Z", + "Date" : "Mon, 29 Jun 2020 19:45:54 GMT", + "x-ms-client-request-id" : "79e2f1e1-8d63-4c28-bc01-2d13590bc88c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing2929762b48d08a9359439?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "abd73142-a669-4ba4-b8a9-38cb43a1cfd8" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6509B24373", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c3bba817-501e-00a7-1f4d-4e6d37000000", + "Date" : "Mon, 29 Jun 2020 19:45:54 GMT", + "x-ms-client-request-id" : "abd73142-a669-4ba4-b8a9-38cb43a1cfd8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing1200198131a07776d5409?prefix=javablobreadattributesstrparsing371954c0faa80697ab&delimiter=/&maxresults=2&include=metadata&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "50c9a484-c686-4a81-85c4-cbb76296d9ca" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "4b2434ef-f01e-00a1-354d-4e9a4f000000", + "Body" : "javablobreadattributesstrparsing371954c0faa80697ab2/", + "Date" : "Mon, 29 Jun 2020 19:45:55 GMT", + "x-ms-client-request-id" : "50c9a484-c686-4a81-85c4-cbb76296d9ca", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing1200198131a07776d5409/javablobreadattributesstrparsing371954c0faa80697ab", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "7e42ee5e-264c-46b2-9372-ae2aa6f2cc0a", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "AAAAAAAAAAA=", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:45:54 GMT", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "ETag" : "0x8D81C6509E7345D", + "Content-Length" : "0", + "x-ms-request-id" : "2a49b2a8-d01e-0113-5e4d-4e2760000000", + "x-ms-client-request-id" : "7e42ee5e-264c-46b2-9372-ae2aa6f2cc0a" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing1200198131a07776d5409/javablobreadattributesstrparsing371954c0faa80697ab", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "d4cc3c4f-8574-438d-9248-291358c03f3c" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:55 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:45:55 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "0x8D81C6509E7345D", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:45:55 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "95056e1d-001e-005a-434d-4e5255000000", + "x-ms-client-request-id" : "d4cc3c4f-8574-438d-9248-291358c03f3c", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcreadattributesstrparsing&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "0ac05e59-b79d-4887-9865-2be9f0c4a220" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "aab876e1-301e-0130-694d-4e48ab000000", + "Body" : "jtcreadattributesstrparsingjtcreadattributesstrparsing1200198131a07776d5409Mon, 29 Jun 2020 19:45:54 GMT\"0x8D81C65097F4F2F\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcreadattributesstrparsing2929762b48d08a9359439Mon, 29 Jun 2020 19:45:55 GMT\"0x8D81C6509B24373\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:45:55 GMT", + "x-ms-client-request-id" : "0ac05e59-b79d-4887-9865-2be9f0c4a220", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing1200198131a07776d5409?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "688faff2-c113-45fd-b1e0-5f7a0208e368" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "996bd7ea-601e-0027-1c4d-4ece9d000000", + "Date" : "Mon, 29 Jun 2020 19:45:55 GMT", + "x-ms-client-request-id" : "688faff2-c113-45fd-b1e0-5f7a0208e368" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing2929762b48d08a9359439?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "637dc294-5dbe-47ea-a113-bf3eb77d5e6d" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d027a5fa-001e-0111-574d-4e259a000000", + "Date" : "Mon, 29 Jun 2020 19:45:55 GMT", + "x-ms-client-request-id" : "637dc294-5dbe-47ea-a113-bf3eb77d5e6d" + }, + "Exception" : null + } ], + "variables" : [ "jtcreadattributesstrparsing0228370c759517a46e439", "jtcreadattributesstrparsing1200198131a07776d5409", "jtcreadattributesstrparsing2929762b48d08a9359439", "javablobreadattributesstrparsing371954c0faa80697ab" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrparsing[6].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrparsing[6].json new file mode 100644 index 000000000000..299986d73906 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrparsing[6].json @@ -0,0 +1,226 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing1633256c19c31cbfd9424?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "4662b9ec-4233-4b57-8db6-c980820bfed0" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "f979e035-001e-0133-2e4d-4e4bac000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:f979e035-001e-0133-2e4d-4e4bac000000\nTime:2020-06-29T19:45:56.7178339Z", + "Date" : "Mon, 29 Jun 2020 19:45:55 GMT", + "x-ms-client-request-id" : "4662b9ec-4233-4b57-8db6-c980820bfed0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing1633256c19c31cbfd9424?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "3dae43e3-09ca-422d-b062-09cfe0da4240" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C650AA3A296", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d9b670f2-f01e-0066-0d4d-4ee68e000000", + "Date" : "Mon, 29 Jun 2020 19:45:56 GMT", + "x-ms-client-request-id" : "3dae43e3-09ca-422d-b062-09cfe0da4240" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing265256429b07ba3f994b3?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "1bd6382b-ee13-4269-8204-e8522f5ff34a" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "aac9b7de-701e-0038-434d-4e158d000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:aac9b7de-701e-0038-434d-4e158d000000\nTime:2020-06-29T19:45:57.1486609Z", + "Date" : "Mon, 29 Jun 2020 19:45:56 GMT", + "x-ms-client-request-id" : "1bd6382b-ee13-4269-8204-e8522f5ff34a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing265256429b07ba3f994b3?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "3d4fadfd-c55b-4ad2-974c-fe1e59fa889e" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C650AE5BE71", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "355c8bb2-e01e-001f-2c4d-4e8fc4000000", + "Date" : "Mon, 29 Jun 2020 19:45:56 GMT", + "x-ms-client-request-id" : "3d4fadfd-c55b-4ad2-974c-fe1e59fa889e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing1633256c19c31cbfd9424?prefix=javablobreadattributesstrparsing32471202c51554913b&delimiter=/&maxresults=2&include=metadata&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "8c8d270f-8725-4a1a-ba9d-c5243df742dd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f20f134b-901e-007d-2b4d-4ec81c000000", + "Body" : "javablobreadattributesstrparsing32471202c51554913b2/", + "Date" : "Mon, 29 Jun 2020 19:45:57 GMT", + "x-ms-client-request-id" : "8c8d270f-8725-4a1a-ba9d-c5243df742dd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing1633256c19c31cbfd9424/javablobreadattributesstrparsing32471202c51554913b", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "f83b2870-9be2-4dda-b8b7-1c062e740906", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "AAAAAAAAAAA=", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:45:57 GMT", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "ETag" : "0x8D81C650B21EAB6", + "Content-Length" : "0", + "x-ms-request-id" : "f157b301-f01e-004f-734d-4e90cc000000", + "x-ms-client-request-id" : "f83b2870-9be2-4dda-b8b7-1c062e740906" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing1633256c19c31cbfd9424/javablobreadattributesstrparsing32471202c51554913b", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "c53c39bd-811c-40ac-ac2e-4c4b7a3c39fd" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:57 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:45:57 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "0x8D81C650B21EAB6", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:45:57 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "e1ac61ba-f01e-0022-7a4d-4e3ae2000000", + "x-ms-client-request-id" : "c53c39bd-811c-40ac-ac2e-4c4b7a3c39fd", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcreadattributesstrparsing&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "222ddd39-9d29-42a8-bc27-8681d98e146d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2b596be5-d01e-001c-3c4d-4e8cc3000000", + "Body" : "jtcreadattributesstrparsingjtcreadattributesstrparsing1633256c19c31cbfd9424Mon, 29 Jun 2020 19:45:56 GMT\"0x8D81C650AA3A296\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcreadattributesstrparsing265256429b07ba3f994b3Mon, 29 Jun 2020 19:45:57 GMT\"0x8D81C650AE5BE71\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:45:57 GMT", + "x-ms-client-request-id" : "222ddd39-9d29-42a8-bc27-8681d98e146d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing1633256c19c31cbfd9424?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "f168138b-4249-4512-a820-c7773b8451af" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "73b8104f-d01e-007a-044d-4e3e99000000", + "Date" : "Mon, 29 Jun 2020 19:45:57 GMT", + "x-ms-client-request-id" : "f168138b-4249-4512-a820-c7773b8451af" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing265256429b07ba3f994b3?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "7c6bfe45-c10b-49a2-b30b-4f0338e25f64" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "3e91f47d-201e-004d-244d-4e9236000000", + "Date" : "Mon, 29 Jun 2020 19:45:58 GMT", + "x-ms-client-request-id" : "7c6bfe45-c10b-49a2-b30b-4f0338e25f64" + }, + "Exception" : null + } ], + "variables" : [ "jtcreadattributesstrparsing096523654c178d9dde4a9", "jtcreadattributesstrparsing1633256c19c31cbfd9424", "jtcreadattributesstrparsing265256429b07ba3f994b3", "javablobreadattributesstrparsing32471202c51554913b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrparsing[7].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrparsing[7].json new file mode 100644 index 000000000000..9f10e0638fcb --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesstrparsing[7].json @@ -0,0 +1,226 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing195374cd18ae750a5b4ef?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "0a543490-5165-4fe5-96e0-a62868eae5f8" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "5c629bc2-e01e-0097-0d4d-4e371d000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:5c629bc2-e01e-0097-0d4d-4e371d000000\nTime:2020-06-29T19:45:58.4885041Z", + "Date" : "Mon, 29 Jun 2020 19:45:58 GMT", + "x-ms-client-request-id" : "0a543490-5165-4fe5-96e0-a62868eae5f8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing195374cd18ae750a5b4ef?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "689b951c-5478-4183-8078-b450038e1823" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C650BB3088F", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "fd48d9ed-501e-0042-0d4d-4e7fc0000000", + "Date" : "Mon, 29 Jun 2020 19:45:58 GMT", + "x-ms-client-request-id" : "689b951c-5478-4183-8078-b450038e1823" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing204292b1a8608c41b245a?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "38a8e382-04c1-478d-ad87-9922ca05cf0e" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "0d15b57a-101e-00a0-3e4d-4e9bb2000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:0d15b57a-101e-00a0-3e4d-4e9bb2000000\nTime:2020-06-29T19:45:58.8007445Z", + "Date" : "Mon, 29 Jun 2020 19:45:58 GMT", + "x-ms-client-request-id" : "38a8e382-04c1-478d-ad87-9922ca05cf0e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing204292b1a8608c41b245a?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "9d239ef9-775e-4aad-ad49-2ea0b2948836" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C650BE1A493", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "74f45c32-401e-009a-544d-4ed811000000", + "Date" : "Mon, 29 Jun 2020 19:45:58 GMT", + "x-ms-client-request-id" : "9d239ef9-775e-4aad-ad49-2ea0b2948836" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing195374cd18ae750a5b4ef?prefix=javablobreadattributesstrparsing34827756c39bd8e59f&delimiter=/&maxresults=2&include=metadata&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "7554f6dc-40b4-4429-88bd-fef864b02ca4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "66c74b72-301e-001d-7a4d-4e8d3e000000", + "Body" : "javablobreadattributesstrparsing34827756c39bd8e59f2/", + "Date" : "Mon, 29 Jun 2020 19:45:58 GMT", + "x-ms-client-request-id" : "7554f6dc-40b4-4429-88bd-fef864b02ca4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing195374cd18ae750a5b4ef/javablobreadattributesstrparsing34827756c39bd8e59f", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "1c4a2a6d-6bb7-4c1f-b5c1-965cb86b9ae5", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "AAAAAAAAAAA=", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:59 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:45:58 GMT", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "ETag" : "0x8D81C650C150352", + "Content-Length" : "0", + "x-ms-request-id" : "feff2579-301e-00f3-754d-4e87bd000000", + "x-ms-client-request-id" : "1c4a2a6d-6bb7-4c1f-b5c1-965cb86b9ae5" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing195374cd18ae750a5b4ef/javablobreadattributesstrparsing34827756c39bd8e59f", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "7ea0025e-6d52-4509-a79e-79198f580b9b" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:59 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:45:59 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "0x8D81C650C150352", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:45:59 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "18fbdc08-001e-009d-424d-4e2e94000000", + "x-ms-client-request-id" : "7ea0025e-6d52-4509-a79e-79198f580b9b", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcreadattributesstrparsing&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "36691de3-3aff-4071-b420-244eadd6da37" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "5e5db541-201e-0124-344d-4e8bcf000000", + "Body" : "jtcreadattributesstrparsingjtcreadattributesstrparsing195374cd18ae750a5b4efMon, 29 Jun 2020 19:45:58 GMT\"0x8D81C650BB3088F\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcreadattributesstrparsing204292b1a8608c41b245aMon, 29 Jun 2020 19:45:58 GMT\"0x8D81C650BE1A493\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:45:59 GMT", + "x-ms-client-request-id" : "36691de3-3aff-4071-b420-244eadd6da37", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing195374cd18ae750a5b4ef?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "ab09e2bd-24e1-4b40-b5ce-184337262d1b" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "fc2f7398-201e-00ce-634d-4e329b000000", + "Date" : "Mon, 29 Jun 2020 19:45:59 GMT", + "x-ms-client-request-id" : "ab09e2bd-24e1-4b40-b5ce-184337262d1b" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesstrparsing204292b1a8608c41b245a?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "09ec0f61-37aa-4189-9843-956ec7d838df" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "500a9dc2-c01e-0065-064d-4ee589000000", + "Date" : "Mon, 29 Jun 2020 19:45:59 GMT", + "x-ms-client-request-id" : "09ec0f61-37aa-4189-9843-956ec7d838df" + }, + "Exception" : null + } ], + "variables" : [ "jtcreadattributesstrparsing065375d2a2758cd48b45f", "jtcreadattributesstrparsing195374cd18ae750a5b4ef", "jtcreadattributesstrparsing204292b1a8608c41b245a", "javablobreadattributesstrparsing34827756c39bd8e59f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesunsupported.json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesunsupported.json new file mode 100644 index 000000000000..803712c7ce41 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestreadattributesunsupported.json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesunsupported164923c34882698db54a?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "cf3bf2da-3e0b-475a-a145-9e12a5c816e9" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "f3c418d3-f01e-00aa-2b4d-4e823b000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:f3c418d3-f01e-00aa-2b4d-4e823b000000\nTime:2020-06-29T19:45:42.9355595Z", + "Date" : "Mon, 29 Jun 2020 19:45:42 GMT", + "x-ms-client-request-id" : "cf3bf2da-3e0b-475a-a145-9e12a5c816e9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesunsupported164923c34882698db54a?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "40c7ab51-6981-45e2-9cf9-345dc8168d96" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C65026DCDEB", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c12dd213-a01e-011c-494d-4eca96000000", + "Date" : "Mon, 29 Jun 2020 19:45:43 GMT", + "x-ms-client-request-id" : "40c7ab51-6981-45e2-9cf9-345dc8168d96" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesunsupported246930c0b44fefe7a64b?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "28075f0e-fe4b-4766-8954-7f2115925ae4" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "0003baed-301e-009e-544d-4e2d93000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:0003baed-301e-009e-544d-4e2d93000000\nTime:2020-06-29T19:45:43.2570938Z", + "Date" : "Mon, 29 Jun 2020 19:45:42 GMT", + "x-ms-client-request-id" : "28075f0e-fe4b-4766-8954-7f2115925ae4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesunsupported246930c0b44fefe7a64b?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "703b2a73-4b4b-4144-9783-8ee99457f942" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C65029F07C7", + "Last-Modified" : "Mon, 29 Jun 2020 19:45:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7db2c778-d01e-0035-3d4d-4efa81000000", + "Date" : "Mon, 29 Jun 2020 19:45:43 GMT", + "x-ms-client-request-id" : "703b2a73-4b4b-4144-9783-8ee99457f942" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcreadattributesunsupported&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "4aec31a5-9225-4cdb-b36e-78caaf901dad" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f8c3e7a1-401e-007f-6f4d-4ecae6000000", + "Body" : "jtcreadattributesunsupportedjtcreadattributesunsupported164923c34882698db54aMon, 29 Jun 2020 19:45:43 GMT\"0x8D81C65026DCDEB\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcreadattributesunsupported246930c0b44fefe7a64bMon, 29 Jun 2020 19:45:43 GMT\"0x8D81C65029F07C7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:45:42 GMT", + "x-ms-client-request-id" : "4aec31a5-9225-4cdb-b36e-78caaf901dad", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesunsupported164923c34882698db54a?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "d20b9358-8564-491a-887c-ab4d277d3ccd" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "3d526401-e01e-00b5-564d-4e592b000000", + "Date" : "Mon, 29 Jun 2020 19:45:43 GMT", + "x-ms-client-request-id" : "d20b9358-8564-491a-887c-ab4d277d3ccd" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcreadattributesunsupported246930c0b44fefe7a64b?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "6e2cec86-3d8b-426c-902a-9c0db631c228" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "575cd768-701e-013c-4d4d-4ea65a000000", + "Date" : "Mon, 29 Jun 2020 19:45:43 GMT", + "x-ms-client-request-id" : "6e2cec86-3d8b-426c-902a-9c0db631c228" + }, + "Exception" : null + } ], + "variables" : [ "jtcreadattributesunsupported045742a8798ea960cf46", "jtcreadattributesunsupported164923c34882698db54a", "jtcreadattributesunsupported246930c0b44fefe7a64b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesdirectory.json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesdirectory.json new file mode 100644 index 000000000000..69b59952ba07 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesdirectory.json @@ -0,0 +1,192 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesdirectory166595c040d69d3c414eac?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "1a4b56e0-5e6d-497c-9dfd-508b592fd9f5" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "39d762f6-301e-0112-4b4d-4e269d000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:39d762f6-301e-0112-4b4d-4e269d000000\nTime:2020-06-29T19:46:20.3613308Z", + "Date" : "Mon, 29 Jun 2020 19:46:19 GMT", + "x-ms-client-request-id" : "1a4b56e0-5e6d-497c-9dfd-508b592fd9f5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesdirectory166595c040d69d3c414eac?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "72e0be11-d371-4227-9c22-a4d1ebc4ae0e" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6518BB067A", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9017a3f9-b01e-0121-034d-4e7fb0000000", + "Date" : "Mon, 29 Jun 2020 19:46:20 GMT", + "x-ms-client-request-id" : "72e0be11-d371-4227-9c22-a4d1ebc4ae0e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesdirectory285721ecd8f4ec22d54cd1?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "8d0f7c74-2530-4419-a880-faffcf7c9496" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "6922d245-c01e-0003-554d-4e57d3000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:6922d245-c01e-0003-554d-4e57d3000000\nTime:2020-06-29T19:46:20.6675576Z", + "Date" : "Mon, 29 Jun 2020 19:46:20 GMT", + "x-ms-client-request-id" : "8d0f7c74-2530-4419-a880-faffcf7c9496", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesdirectory285721ecd8f4ec22d54cd1?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "9c046eda-7ad5-4bb5-b3ab-6723c9d9f0be" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6518EAE7C9", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d99fa4e0-101e-004e-0e4d-4e9131000000", + "Date" : "Mon, 29 Jun 2020 19:46:20 GMT", + "x-ms-client-request-id" : "9c046eda-7ad5-4bb5-b3ab-6723c9d9f0be" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesdirectory166595c040d69d3c414eac/javablobsetattributesdirectory332512e8b07c487d964?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "5efcd4cf-e5a0-44dd-b8cf-833fc4cfbb8d", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C65190581A0", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "30d848ad-b01e-0084-4d4d-4e02fc000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:46:20 GMT", + "x-ms-client-request-id" : "5efcd4cf-e5a0-44dd-b8cf-833fc4cfbb8d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesdirectory166595c040d69d3c414eac/javablobsetattributesdirectory332512e8b07c487d964?comp=tier", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "cee29a72-4f13-4f21-a061-cbc109918b39" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d86f8ff1-b01e-00a6-294d-4e6cca000000", + "Date" : "Mon, 29 Jun 2020 19:46:20 GMT", + "x-ms-client-request-id" : "cee29a72-4f13-4f21-a061-cbc109918b39" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcsetattributesdirectory&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "e4f7489b-c9c6-497e-80fa-09acadbbeb89" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "5535c9ad-701e-00dd-234d-4e077a000000", + "Body" : "jtcsetattributesdirectoryjtcsetattributesdirectory166595c040d69d3c414eacMon, 29 Jun 2020 19:46:20 GMT\"0x8D81C6518BB067A\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsetattributesdirectory285721ecd8f4ec22d54cd1Mon, 29 Jun 2020 19:46:20 GMT\"0x8D81C6518EAE7C9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:46:20 GMT", + "x-ms-client-request-id" : "e4f7489b-c9c6-497e-80fa-09acadbbeb89", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesdirectory166595c040d69d3c414eac?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "94d72afe-4c05-4410-bc8e-b751ce12bae5" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0d2d7c6b-801e-00c3-204d-4edd97000000", + "Date" : "Mon, 29 Jun 2020 19:46:21 GMT", + "x-ms-client-request-id" : "94d72afe-4c05-4410-bc8e-b751ce12bae5" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesdirectory285721ecd8f4ec22d54cd1?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "a04d8526-b98f-46b2-b369-84e8e54697c3" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "080e018d-c01e-00e6-494d-4e4524000000", + "Date" : "Mon, 29 Jun 2020 19:46:20 GMT", + "x-ms-client-request-id" : "a04d8526-b98f-46b2-b369-84e8e54697c3" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetattributesdirectory054127802b12bf68f44bfa", "jtcsetattributesdirectory166595c040d69d3c414eac", "jtcsetattributesdirectory285721ecd8f4ec22d54cd1", "javablobsetattributesdirectory332512e8b07c487d964" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesheaders[0].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesheaders[0].json new file mode 100644 index 000000000000..499a89dc7e2a --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesheaders[0].json @@ -0,0 +1,245 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesheaders139367cc0595bb7033488c8?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "9f3170e5-e810-43c2-8291-6c6b3c8780c5" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "2b5d0acc-c01e-0008-734d-4e4fa7000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:2b5d0acc-c01e-0008-734d-4e4fa7000000\nTime:2020-06-29T19:46:07.5174812Z", + "Date" : "Mon, 29 Jun 2020 19:46:06 GMT", + "x-ms-client-request-id" : "9f3170e5-e810-43c2-8291-6c6b3c8780c5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesheaders139367cc0595bb7033488c8?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "5097795f-ac1d-4b4f-83f2-b8971eef8160" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6511156EF0", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "fe4cdcfb-d01e-00f2-184d-4e8640000000", + "Date" : "Mon, 29 Jun 2020 19:46:07 GMT", + "x-ms-client-request-id" : "5097795f-ac1d-4b4f-83f2-b8971eef8160" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesheaders292182f5f82bede16443d8a?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "74c09439-28e7-4443-a230-84b639f2588c" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "1d87bf6d-e01e-009c-284d-4e2f69000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:1d87bf6d-e01e-009c-284d-4e2f69000000\nTime:2020-06-29T19:46:07.9150846Z", + "Date" : "Mon, 29 Jun 2020 19:46:07 GMT", + "x-ms-client-request-id" : "74c09439-28e7-4443-a230-84b639f2588c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesheaders292182f5f82bede16443d8a?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "2e1591b5-7bc8-4e00-ac92-2edb15e92515" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6511511EBC", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "4e96fb3c-601e-0123-184d-4e7d4a000000", + "Date" : "Mon, 29 Jun 2020 19:46:07 GMT", + "x-ms-client-request-id" : "2e1591b5-7bc8-4e00-ac92-2edb15e92515" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesheaders139367cc0595bb7033488c8?prefix=javablobsetattributesheaders3043924aad8d41482d41&delimiter=/&maxresults=2&include=metadata&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "2b960956-d95f-470c-b885-6c9c96f470db" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0e9a2078-401e-011d-6d4d-4ecb6b000000", + "Body" : "javablobsetattributesheaders3043924aad8d41482d412/", + "Date" : "Mon, 29 Jun 2020 19:46:07 GMT", + "x-ms-client-request-id" : "2b960956-d95f-470c-b885-6c9c96f470db", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesheaders139367cc0595bb7033488c8/javablobsetattributesheaders3043924aad8d41482d41", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "dc0eda63-f971-472c-b385-b43bd1bbaf49", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "AAAAAAAAAAA=", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:46:08 GMT", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "ETag" : "0x8D81C6511818098", + "Content-Length" : "0", + "x-ms-request-id" : "b7434ca6-101e-0028-2e4d-4e236b000000", + "x-ms-client-request-id" : "dc0eda63-f971-472c-b385-b43bd1bbaf49" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesheaders139367cc0595bb7033488c8/javablobsetattributesheaders3043924aad8d41482d41?comp=properties", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "f2bd53b7-ae7e-4b3d-a426-07c7b32c4660" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C65119DC06A", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "a1e89ba3-701e-00d6-5c4d-4e1f0e000000", + "Date" : "Mon, 29 Jun 2020 19:46:08 GMT", + "x-ms-client-request-id" : "f2bd53b7-ae7e-4b3d-a426-07c7b32c4660" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesheaders139367cc0595bb7033488c8/javablobsetattributesheaders3043924aad8d41482d41", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "bad5828f-f8e0-4246-bd9d-ff951b95cce6" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:08 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:46:08 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "0x8D81C65119DC06A", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:46:08 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "a728a49d-c01e-010c-024d-4efc70000000", + "x-ms-client-request-id" : "bad5828f-f8e0-4246-bd9d-ff951b95cce6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcsetattributesheaders&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "7dad69e3-c8df-42af-837c-c5fac5d9533a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "a87a006c-101e-0067-1b4d-4ee773000000", + "Body" : "jtcsetattributesheadersjtcsetattributesheaders139367cc0595bb7033488c8Mon, 29 Jun 2020 19:46:07 GMT\"0x8D81C6511156EF0\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsetattributesheaders292182f5f82bede16443d8aMon, 29 Jun 2020 19:46:08 GMT\"0x8D81C6511511EBC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:46:08 GMT", + "x-ms-client-request-id" : "7dad69e3-c8df-42af-837c-c5fac5d9533a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesheaders139367cc0595bb7033488c8?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "d2789f64-3257-4514-abd0-ac7f9ee3bea0" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "13164c9b-101e-0089-234d-4eedf0000000", + "Date" : "Mon, 29 Jun 2020 19:46:08 GMT", + "x-ms-client-request-id" : "d2789f64-3257-4514-abd0-ac7f9ee3bea0" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesheaders292182f5f82bede16443d8a?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "92b434d8-9e20-4a93-964d-8c19faa4825f" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9c7a537e-a01e-005c-754d-4ea52d000000", + "Date" : "Mon, 29 Jun 2020 19:46:08 GMT", + "x-ms-client-request-id" : "92b434d8-9e20-4a93-964d-8c19faa4825f" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetattributesheaders010671ad08ddbcaaad4e7a8", "jtcsetattributesheaders139367cc0595bb7033488c8", "jtcsetattributesheaders292182f5f82bede16443d8a", "javablobsetattributesheaders3043924aad8d41482d41" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesheaders[1].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesheaders[1].json new file mode 100644 index 000000000000..14ba2f780116 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesheaders[1].json @@ -0,0 +1,251 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesheaders1785294f40da8ca21046d3b?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "a30c8293-730c-4238-83e6-923c5e5d4b66" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "657020c5-401e-0056-614d-4ebca4000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:657020c5-401e-0056-614d-4ebca4000000\nTime:2020-06-29T19:46:09.3766519Z", + "Date" : "Mon, 29 Jun 2020 19:46:09 GMT", + "x-ms-client-request-id" : "a30c8293-730c-4238-83e6-923c5e5d4b66", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesheaders1785294f40da8ca21046d3b?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "cb3415c8-bed4-4718-95d8-8ded67439c58" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6512323072", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c79ce22b-901e-00dc-4d4d-4e0687000000", + "Date" : "Mon, 29 Jun 2020 19:46:09 GMT", + "x-ms-client-request-id" : "cb3415c8-bed4-4718-95d8-8ded67439c58" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesheaders26576677ed2fcbd1e747fb9?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "2fb9b2d6-6b08-4342-8402-caeaa38e6dde" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "36bbe296-101e-0127-284d-4e88c8000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:36bbe296-101e-0127-284d-4e88c8000000\nTime:2020-06-29T19:46:09.7043334Z", + "Date" : "Mon, 29 Jun 2020 19:46:08 GMT", + "x-ms-client-request-id" : "2fb9b2d6-6b08-4342-8402-caeaa38e6dde", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesheaders26576677ed2fcbd1e747fb9?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "406c629b-7b7c-4ac2-b198-4d7859d3d207" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C651261C44F", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "3b35239a-101e-0045-0b4d-4e8945000000", + "Date" : "Mon, 29 Jun 2020 19:46:08 GMT", + "x-ms-client-request-id" : "406c629b-7b7c-4ac2-b198-4d7859d3d207" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesheaders1785294f40da8ca21046d3b?prefix=javablobsetattributesheaders381324cc426dc48db34b&delimiter=/&maxresults=2&include=metadata&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "f8a7532c-0fbe-48e4-8405-905186cb770a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f6031899-d01e-0017-5d4d-4e94b7000000", + "Body" : "javablobsetattributesheaders381324cc426dc48db34b2/", + "Date" : "Mon, 29 Jun 2020 19:46:09 GMT", + "x-ms-client-request-id" : "f8a7532c-0fbe-48e4-8405-905186cb770a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesheaders1785294f40da8ca21046d3b/javablobsetattributesheaders381324cc426dc48db34b", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "5fb7d9fa-ac81-4e8c-b82b-b99bea032448", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "AAAAAAAAAAA=", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:46:09 GMT", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "ETag" : "0x8D81C651292D523", + "Content-Length" : "0", + "x-ms-request-id" : "f71e7dc1-201e-008a-474d-4eeef7000000", + "x-ms-client-request-id" : "5fb7d9fa-ac81-4e8c-b82b-b99bea032448" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesheaders1785294f40da8ca21046d3b/javablobsetattributesheaders381324cc426dc48db34b?comp=properties", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "e63bba33-723f-4545-9e43-9029baee3528" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6512AF14F9", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8cccc8b7-001e-0138-764d-4e53d8000000", + "Date" : "Mon, 29 Jun 2020 19:46:09 GMT", + "x-ms-client-request-id" : "e63bba33-723f-4545-9e43-9029baee3528" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesheaders1785294f40da8ca21046d3b/javablobsetattributesheaders381324cc426dc48db34b", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "cb11112f-4c74-4084-baf6-e9a29743e51f" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:10 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:46:10 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "d2grV20xOEQwejFENEUrUEUyNTJnZz09", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "Cache-Control" : "control", + "ETag" : "0x8D81C6512AF14F9", + "Content-Disposition" : "disposition", + "Content-Encoding" : "encoding", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:46:10 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "1c1c4bc7-b01e-0043-214d-4e7e3d000000", + "x-ms-client-request-id" : "cb11112f-4c74-4084-baf6-e9a29743e51f", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcsetattributesheaders&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "1237a329-fbf8-4612-b8aa-e8fed9b578fe" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "33a43d4c-e01e-00f1-2a4d-4e8547000000", + "Body" : "jtcsetattributesheadersjtcsetattributesheaders1785294f40da8ca21046d3bMon, 29 Jun 2020 19:46:09 GMT\"0x8D81C6512323072\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsetattributesheaders26576677ed2fcbd1e747fb9Mon, 29 Jun 2020 19:46:09 GMT\"0x8D81C651261C44F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:46:10 GMT", + "x-ms-client-request-id" : "1237a329-fbf8-4612-b8aa-e8fed9b578fe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesheaders1785294f40da8ca21046d3b?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "e3a0ee10-5b76-45f9-b81d-9da8804a0ac4" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c6bca916-a01e-009b-164d-4ed9ec000000", + "Date" : "Mon, 29 Jun 2020 19:46:10 GMT", + "x-ms-client-request-id" : "e3a0ee10-5b76-45f9-b81d-9da8804a0ac4" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesheaders26576677ed2fcbd1e747fb9?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "14adc144-7959-4f07-89e9-bdbcd8e6d27b" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "489bab3e-101e-000a-414d-4e4d5d000000", + "Date" : "Mon, 29 Jun 2020 19:46:10 GMT", + "x-ms-client-request-id" : "14adc144-7959-4f07-89e9-bdbcd8e6d27b" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetattributesheaders042989951874eeca4b436eb", "jtcsetattributesheaders1785294f40da8ca21046d3b", "jtcsetattributesheaders26576677ed2fcbd1e747fb9", "javablobsetattributesheaders381324cc426dc48db34b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesia[0].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesia[0].json new file mode 100644 index 000000000000..76868814dc60 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesia[0].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesia1431794a4f70fb31454f11a62?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "e9305356-998b-4a2f-9f3c-a8dc7d5015aa" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "2661b124-701e-007c-2e4d-4ec9e1000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:2661b124-701e-007c-2e4d-4ec9e1000000\nTime:2020-06-29T19:46:21.8051013Z", + "Date" : "Mon, 29 Jun 2020 19:46:21 GMT", + "x-ms-client-request-id" : "e9305356-998b-4a2f-9f3c-a8dc7d5015aa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesia1431794a4f70fb31454f11a62?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "3c7fd169-3243-4a73-a8c5-d706387cb743" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C65199802DE", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "49bc7c4b-401e-0012-664d-4e60c8000000", + "Date" : "Mon, 29 Jun 2020 19:46:21 GMT", + "x-ms-client-request-id" : "3c7fd169-3243-4a73-a8c5-d706387cb743" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesia26338965e416068c9b406fae4?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "c825a53b-33e1-4260-86c9-c2f3764673b9" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "ef14c393-d01e-0071-284d-4e26ed000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:ef14c393-d01e-0071-284d-4e26ed000000\nTime:2020-06-29T19:46:22.1114342Z", + "Date" : "Mon, 29 Jun 2020 19:46:21 GMT", + "x-ms-client-request-id" : "c825a53b-33e1-4260-86c9-c2f3764673b9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesia26338965e416068c9b406fae4?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "f3cd4232-763a-4216-a07c-352859207fa5" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6519CD838E", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "731f6aff-501e-00e3-154d-4eb15b000000", + "Date" : "Mon, 29 Jun 2020 19:46:21 GMT", + "x-ms-client-request-id" : "f3cd4232-763a-4216-a07c-352859207fa5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcsetattributesia&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "ba5d8845-27a7-487e-a998-b719ae22b4b3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "59c83c85-f01e-0029-6f4d-4e2296000000", + "Body" : "jtcsetattributesiajtcsetattributesia1431794a4f70fb31454f11a62Mon, 29 Jun 2020 19:46:21 GMT\"0x8D81C65199802DE\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsetattributesia26338965e416068c9b406fae4Mon, 29 Jun 2020 19:46:22 GMT\"0x8D81C6519CD838E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:46:21 GMT", + "x-ms-client-request-id" : "ba5d8845-27a7-487e-a998-b719ae22b4b3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesia1431794a4f70fb31454f11a62?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "1452c74c-ce61-4a17-b1ba-6f63191cf6c2" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "45c25a73-301e-0052-794d-4e4926000000", + "Date" : "Mon, 29 Jun 2020 19:46:22 GMT", + "x-ms-client-request-id" : "1452c74c-ce61-4a17-b1ba-6f63191cf6c2" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesia26338965e416068c9b406fae4?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "2159208a-b405-483f-a1ac-45db89ad031f" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ff35fcab-f01e-0088-3d4d-4eec0d000000", + "Date" : "Mon, 29 Jun 2020 19:46:22 GMT", + "x-ms-client-request-id" : "2159208a-b405-483f-a1ac-45db89ad031f" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetattributesia02607084ea496dc25443da931", "jtcsetattributesia1431794a4f70fb31454f11a62", "jtcsetattributesia26338965e416068c9b406fae4", "javablobsetattributesia356667236fe2034d184d909" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesia[1].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesia[1].json new file mode 100644 index 000000000000..de367230ad14 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesia[1].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesia189608499d330175354b47b29?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "01d441fb-33bb-4c1a-8beb-12a404f2ed39" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "ba02a953-001e-00fb-4f4d-4e9cce000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:ba02a953-001e-00fb-4f4d-4e9cce000000\nTime:2020-06-29T19:46:22.9716996Z", + "Date" : "Mon, 29 Jun 2020 19:46:22 GMT", + "x-ms-client-request-id" : "01d441fb-33bb-4c1a-8beb-12a404f2ed39", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesia189608499d330175354b47b29?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "4f53b443-6fd4-4969-9847-73e9443010f5" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C651A4A3BEF", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "718c19ae-801e-0069-274d-4e0b78000000", + "Date" : "Mon, 29 Jun 2020 19:46:22 GMT", + "x-ms-client-request-id" : "4f53b443-6fd4-4969-9847-73e9443010f5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesia2126696cd46c7020b3461cbe6?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "82cebbd2-22ec-4760-9c65-b5332ea43d31" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "81d230e8-701e-0077-4e4d-4ed195000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:81d230e8-701e-0077-4e4d-4ed195000000\nTime:2020-06-29T19:46:23.2786451Z", + "Date" : "Mon, 29 Jun 2020 19:46:23 GMT", + "x-ms-client-request-id" : "82cebbd2-22ec-4760-9c65-b5332ea43d31", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesia2126696cd46c7020b3461cbe6?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "fd5926e7-da69-4059-b305-3e263a2cabac" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C651A798B64", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac49c1-601e-00c2-474d-4edc6a000000", + "Date" : "Mon, 29 Jun 2020 19:46:22 GMT", + "x-ms-client-request-id" : "fd5926e7-da69-4059-b305-3e263a2cabac" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcsetattributesia&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "5225e43a-9496-4a0b-8629-d5a07ac2dbae" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "08179c1f-501e-0120-5b4d-4e7e4d000000", + "Body" : "jtcsetattributesiajtcsetattributesia189608499d330175354b47b29Mon, 29 Jun 2020 19:46:23 GMT\"0x8D81C651A4A3BEF\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsetattributesia2126696cd46c7020b3461cbe6Mon, 29 Jun 2020 19:46:23 GMT\"0x8D81C651A798B64\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:46:22 GMT", + "x-ms-client-request-id" : "5225e43a-9496-4a0b-8629-d5a07ac2dbae", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesia189608499d330175354b47b29?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "375015d7-b06e-4b39-83d2-c2640b0e540b" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "5dc83080-201e-012f-134d-4e93bb000000", + "Date" : "Mon, 29 Jun 2020 19:46:23 GMT", + "x-ms-client-request-id" : "375015d7-b06e-4b39-83d2-c2640b0e540b" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesia2126696cd46c7020b3461cbe6?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "034da564-1ae9-4ad3-9902-eb188c77e76a" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b86111a9-201e-00c5-4f4d-4e2aef000000", + "Date" : "Mon, 29 Jun 2020 19:46:23 GMT", + "x-ms-client-request-id" : "034da564-1ae9-4ad3-9902-eb188c77e76a" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetattributesia047710d7f5d19b926145b5afb", "jtcsetattributesia189608499d330175354b47b29", "jtcsetattributesia2126696cd46c7020b3461cbe6", "javablobsetattributesia345110b3ee9bcef06c4f1e9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesia[2].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesia[2].json new file mode 100644 index 000000000000..e79a2cc8374a --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesia[2].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesia1097105d22c32fd1d94491a14?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "adabd76d-e150-4901-8234-a198c60f1649" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "1d82f792-101e-00ab-324d-4e83c6000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:1d82f792-101e-00ab-324d-4e83c6000000\nTime:2020-06-29T19:46:24.1097423Z", + "Date" : "Mon, 29 Jun 2020 19:46:23 GMT", + "x-ms-client-request-id" : "adabd76d-e150-4901-8234-a198c60f1649", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesia1097105d22c32fd1d94491a14?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "b74be643-8b03-41e3-8062-352c642751c2" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C651AFC7B60", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "bc400346-b01e-002e-2a4d-4ed413000000", + "Date" : "Mon, 29 Jun 2020 19:46:23 GMT", + "x-ms-client-request-id" : "b74be643-8b03-41e3-8062-352c642751c2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesia212576b9ef23cd182c45ee888?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "09a5d45e-cea9-4507-a140-ec9099671eb7" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "74b75b91-801e-00c8-254d-4ec5e3000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:74b75b91-801e-00c8-254d-4ec5e3000000\nTime:2020-06-29T19:46:24.4737862Z", + "Date" : "Mon, 29 Jun 2020 19:46:23 GMT", + "x-ms-client-request-id" : "09a5d45e-cea9-4507-a140-ec9099671eb7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesia212576b9ef23cd182c45ee888?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "f41d9259-1a7e-40cc-8904-e5e9409d5df5" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C651B2FE432", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0ba9ee25-f01e-0126-3a4d-4e8935000000", + "Date" : "Mon, 29 Jun 2020 19:46:23 GMT", + "x-ms-client-request-id" : "f41d9259-1a7e-40cc-8904-e5e9409d5df5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcsetattributesia&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "2f6c30a0-cfc6-42c8-9286-00996a266d04" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "dbd2f875-301e-0095-014d-4e35e7000000", + "Body" : "jtcsetattributesiajtcsetattributesia1097105d22c32fd1d94491a14Mon, 29 Jun 2020 19:46:24 GMT\"0x8D81C651AFC7B60\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsetattributesia212576b9ef23cd182c45ee888Mon, 29 Jun 2020 19:46:24 GMT\"0x8D81C651B2FE432\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:46:24 GMT", + "x-ms-client-request-id" : "2f6c30a0-cfc6-42c8-9286-00996a266d04", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesia1097105d22c32fd1d94491a14?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "b3aaa4a9-21d9-48f1-a9e7-e61df300e4ce" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "5203057b-b01e-00cb-294d-4ec6e4000000", + "Date" : "Mon, 29 Jun 2020 19:46:24 GMT", + "x-ms-client-request-id" : "b3aaa4a9-21d9-48f1-a9e7-e61df300e4ce" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesia212576b9ef23cd182c45ee888?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "ed6e3228-9817-4082-b18b-c47a46e881c6" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "10ce243b-601e-0101-694d-4e137c000000", + "Date" : "Mon, 29 Jun 2020 19:46:24 GMT", + "x-ms-client-request-id" : "ed6e3228-9817-4082-b18b-c47a46e881c6" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetattributesia015307cfecd7b5676b4099850", "jtcsetattributesia1097105d22c32fd1d94491a14", "jtcsetattributesia212576b9ef23cd182c45ee888", "javablobsetattributesia30885792ae4c6d643a4d59a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesinvalidview.json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesinvalidview.json new file mode 100644 index 000000000000..c85b6c43c6e9 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesinvalidview.json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesinvalidview10195996dce7a2667c456?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "56024e7d-127d-4ccf-8af7-29519bc8780c" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "718cb782-301e-0070-2a4d-4e2710000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:718cb782-301e-0070-2a4d-4e2710000000\nTime:2020-06-29T19:46:25.2902253Z", + "Date" : "Mon, 29 Jun 2020 19:46:24 GMT", + "x-ms-client-request-id" : "56024e7d-127d-4ccf-8af7-29519bc8780c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesinvalidview10195996dce7a2667c456?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "4f34ae47-08f6-45fa-a1d8-221d64f1664a" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C651BAB80D1", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9fd30435-701e-0092-7a4d-4ec362000000", + "Date" : "Mon, 29 Jun 2020 19:46:24 GMT", + "x-ms-client-request-id" : "4f34ae47-08f6-45fa-a1d8-221d64f1664a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesinvalidview239979f211dd4a30334ec?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "970f8af5-e479-4cf9-8961-24a83e82cfbf" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "905e3889-001e-0051-4c4d-4e4a21000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:905e3889-001e-0051-4c4d-4e4a21000000\nTime:2020-06-29T19:46:25.6061533Z", + "Date" : "Mon, 29 Jun 2020 19:46:25 GMT", + "x-ms-client-request-id" : "970f8af5-e479-4cf9-8961-24a83e82cfbf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesinvalidview239979f211dd4a30334ec?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "9377ae76-07b3-47d9-8304-84e9dba8e9f9" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C651BDFADA6", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e400634d-601e-00eb-794d-4eaa28000000", + "Date" : "Mon, 29 Jun 2020 19:46:25 GMT", + "x-ms-client-request-id" : "9377ae76-07b3-47d9-8304-84e9dba8e9f9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcsetattributesinvalidview&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "b1a0c7b3-1937-4f81-af15-01292c731d56" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ef3506c-f01e-006d-234d-4efefa000000", + "Body" : "jtcsetattributesinvalidviewjtcsetattributesinvalidview10195996dce7a2667c456Mon, 29 Jun 2020 19:46:25 GMT\"0x8D81C651BAB80D1\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsetattributesinvalidview239979f211dd4a30334ecMon, 29 Jun 2020 19:46:25 GMT\"0x8D81C651BDFADA6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:46:25 GMT", + "x-ms-client-request-id" : "b1a0c7b3-1937-4f81-af15-01292c731d56", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesinvalidview10195996dce7a2667c456?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "b2a1a9a3-9657-4f43-b1dc-607c8882471b" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "54ababd7-601e-0068-554d-4e0a85000000", + "Date" : "Mon, 29 Jun 2020 19:46:25 GMT", + "x-ms-client-request-id" : "b2a1a9a3-9657-4f43-b1dc-607c8882471b" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesinvalidview239979f211dd4a30334ec?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "f12a485b-e273-40c0-b9b2-014eef7b2337" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "830b54e3-401e-0116-164d-4ed31f000000", + "Date" : "Mon, 29 Jun 2020 19:46:25 GMT", + "x-ms-client-request-id" : "f12a485b-e273-40c0-b9b2-014eef7b2337" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetattributesinvalidview03556455e76d600eee417", "jtcsetattributesinvalidview10195996dce7a2667c456", "jtcsetattributesinvalidview239979f211dd4a30334ec", "javablobsetattributesinvalidview31079768cb82c94fdc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesioexception.json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesioexception.json new file mode 100644 index 000000000000..2594f31bbeb5 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesioexception.json @@ -0,0 +1,171 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesioexception13246557fd78d1281e4e7?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "e0f3a2a6-11df-4094-807c-921331950359" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "cb0141d9-401e-005d-474d-4ea4d0000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:cb0141d9-401e-005d-474d-4ea4d0000000\nTime:2020-06-29T19:46:26.4552276Z", + "Date" : "Mon, 29 Jun 2020 19:46:25 GMT", + "x-ms-client-request-id" : "e0f3a2a6-11df-4094-807c-921331950359", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesioexception13246557fd78d1281e4e7?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "35cd546b-c07e-406e-8460-4edec5e8c835" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C651C5C3834", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d743a70f-101e-0105-584d-4ee6fe000000", + "Date" : "Mon, 29 Jun 2020 19:46:25 GMT", + "x-ms-client-request-id" : "35cd546b-c07e-406e-8460-4edec5e8c835" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesioexception297532009d1c1bcd324c1?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "813f297f-1b80-4603-82f3-90c5b638ce28" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "2205a733-601e-0128-384d-4e653e000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:2205a733-601e-0128-384d-4e653e000000\nTime:2020-06-29T19:46:26.7623851Z", + "Date" : "Mon, 29 Jun 2020 19:46:26 GMT", + "x-ms-client-request-id" : "813f297f-1b80-4603-82f3-90c5b638ce28", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesioexception297532009d1c1bcd324c1?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "45ba9e32-8625-4b69-b6b3-f3e34d0070d6" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C651C8E23F5", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8a1f8208-901e-0032-6f4d-4e0c04000000", + "Date" : "Mon, 29 Jun 2020 19:46:26 GMT", + "x-ms-client-request-id" : "45ba9e32-8625-4b69-b6b3-f3e34d0070d6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesioexception13246557fd78d1281e4e7/path?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "e0bb7c7d-a5fa-4b20-a748-6e0d517c4c18" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "BlobNotFound", + "retry-after" : "0", + "Content-Length" : "215", + "StatusCode" : "404", + "x-ms-request-id" : "b3f58cf0-b01e-0108-294d-4e09f2000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:b3f58cf0-b01e-0108-294d-4e09f2000000\nTime:2020-06-29T19:46:27.0966509Z", + "Date" : "Mon, 29 Jun 2020 19:46:26 GMT", + "x-ms-client-request-id" : "e0bb7c7d-a5fa-4b20-a748-6e0d517c4c18", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcsetattributesioexception&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "fc00eec3-6989-41c0-833b-4ba793b73c73" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "1259689e-b01e-0103-2f4d-4e1186000000", + "Body" : "jtcsetattributesioexceptionjtcsetattributesioexception13246557fd78d1281e4e7Mon, 29 Jun 2020 19:46:26 GMT\"0x8D81C651C5C3834\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsetattributesioexception297532009d1c1bcd324c1Mon, 29 Jun 2020 19:46:26 GMT\"0x8D81C651C8E23F5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:46:27 GMT", + "x-ms-client-request-id" : "fc00eec3-6989-41c0-833b-4ba793b73c73", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesioexception13246557fd78d1281e4e7?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "7b8b5e4d-115f-4c9b-9ec0-d54f816a7065" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e8a51b17-a01e-00fd-064d-4e6bb6000000", + "Date" : "Mon, 29 Jun 2020 19:46:27 GMT", + "x-ms-client-request-id" : "7b8b5e4d-115f-4c9b-9ec0-d54f816a7065" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesioexception297532009d1c1bcd324c1?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "c2eefbcb-7fa3-43c3-8cf3-3abd264ce104" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "fa8de6a7-401e-00f7-7a4d-4e723f000000", + "Date" : "Mon, 29 Jun 2020 19:46:26 GMT", + "x-ms-client-request-id" : "c2eefbcb-7fa3-43c3-8cf3-3abd264ce104" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetattributesioexception03109155dc124b9bdb446", "jtcsetattributesioexception13246557fd78d1281e4e7", "jtcsetattributesioexception297532009d1c1bcd324c1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesmetadata[0].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesmetadata[0].json new file mode 100644 index 000000000000..01844f4cd605 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesmetadata[0].json @@ -0,0 +1,248 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata1311914e9520535e7941f7?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "275de155-7ef2-4aac-8555-0ed20cb0b6a2" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "37401f95-601e-002c-2d4d-4ed6e9000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:37401f95-601e-002c-2d4d-4ed6e9000000\nTime:2020-06-29T19:46:11.1587958Z", + "Date" : "Mon, 29 Jun 2020 19:46:10 GMT", + "x-ms-client-request-id" : "275de155-7ef2-4aac-8555-0ed20cb0b6a2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata1311914e9520535e7941f7?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "002ba182-c514-4c23-a481-e1d8d3c7e814" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C651340D21D", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9d0ce495-901e-0076-654d-4ed068000000", + "Date" : "Mon, 29 Jun 2020 19:46:10 GMT", + "x-ms-client-request-id" : "002ba182-c514-4c23-a481-e1d8d3c7e814" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata228246a7ce7818ff554076?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "a8d8d1e2-4ceb-4c83-bdff-ed36cff3176a" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "dae87fd7-c01e-0021-304d-4e39e5000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:dae87fd7-c01e-0021-304d-4e39e5000000\nTime:2020-06-29T19:46:11.4780606Z", + "Date" : "Mon, 29 Jun 2020 19:46:10 GMT", + "x-ms-client-request-id" : "a8d8d1e2-4ceb-4c83-bdff-ed36cff3176a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata228246a7ce7818ff554076?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "a7fd3177-e609-4d69-ae7e-dd913a6028b5" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C65136FCA51", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "74e2ff42-b01e-0007-024d-4ea251000000", + "Date" : "Mon, 29 Jun 2020 19:46:10 GMT", + "x-ms-client-request-id" : "a7fd3177-e609-4d69-ae7e-dd913a6028b5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata1311914e9520535e7941f7?prefix=javablobsetattributesmetadata373507c87ccd01513d42&delimiter=/&maxresults=2&include=metadata&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "64dce5ec-022e-4abb-9f24-1f55ac357034" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "4988749b-c01e-002a-314d-4e2191000000", + "Body" : "javablobsetattributesmetadata373507c87ccd01513d422/", + "Date" : "Mon, 29 Jun 2020 19:46:11 GMT", + "x-ms-client-request-id" : "64dce5ec-022e-4abb-9f24-1f55ac357034", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata1311914e9520535e7941f7/javablobsetattributesmetadata373507c87ccd01513d42", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "e8ccb93d-ab33-48de-bc6e-a3080d80cf49", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "AAAAAAAAAAA=", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:46:11 GMT", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "ETag" : "0x8D81C65139DC027", + "Content-Length" : "0", + "x-ms-request-id" : "f9c65c16-901e-0010-114d-4e6232000000", + "x-ms-client-request-id" : "e8ccb93d-ab33-48de-bc6e-a3080d80cf49" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata1311914e9520535e7941f7/javablobsetattributesmetadata373507c87ccd01513d42?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "e46c5681-5e92-4a6f-9acd-d2c552dfd160" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6513B7193A", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2ed50b2b-101e-010e-6c4d-4efe8a000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:46:11 GMT", + "x-ms-client-request-id" : "e46c5681-5e92-4a6f-9acd-d2c552dfd160" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata1311914e9520535e7941f7/javablobsetattributesmetadata373507c87ccd01513d42", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "afe9dfdf-15d5-402b-b772-d4fcf1d42727" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:12 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:46:11 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "0x8D81C6513B7193A", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:46:11 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "344d94d4-801e-00a5-5f4d-4e6fcd000000", + "x-ms-client-request-id" : "afe9dfdf-15d5-402b-b772-d4fcf1d42727", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcsetattributesmetadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "e230c591-71ff-4f2c-91f8-388ff1692a3a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "464ecc53-501e-012b-694d-4e6639000000", + "Body" : "jtcsetattributesmetadatajtcsetattributesmetadata1311914e9520535e7941f7Mon, 29 Jun 2020 19:46:11 GMT\"0x8D81C651340D21D\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsetattributesmetadata228246a7ce7818ff554076Mon, 29 Jun 2020 19:46:11 GMT\"0x8D81C65136FCA51\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:46:11 GMT", + "x-ms-client-request-id" : "e230c591-71ff-4f2c-91f8-388ff1692a3a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata1311914e9520535e7941f7?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "46f0a37f-cf9d-4984-bd8c-b1091a82a370" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b9f0c41d-e01e-0139-344d-4e5225000000", + "Date" : "Mon, 29 Jun 2020 19:46:12 GMT", + "x-ms-client-request-id" : "46f0a37f-cf9d-4984-bd8c-b1091a82a370" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata228246a7ce7818ff554076?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "d4b9842a-f98e-4f09-a3d0-841f50fb84a1" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "4486704f-101e-006c-6c4d-4eff07000000", + "Date" : "Mon, 29 Jun 2020 19:46:12 GMT", + "x-ms-client-request-id" : "d4b9842a-f98e-4f09-a3d0-841f50fb84a1" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetattributesmetadata082602b72d220f87d742e7", "jtcsetattributesmetadata1311914e9520535e7941f7", "jtcsetattributesmetadata228246a7ce7818ff554076", "javablobsetattributesmetadata373507c87ccd01513d42" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesmetadata[1].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesmetadata[1].json new file mode 100644 index 000000000000..7bec711cb4a4 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesmetadata[1].json @@ -0,0 +1,250 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata196747e58e60b41a2645d4?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "63bcb1fa-4740-4dee-894c-be6691ebf8c0" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "0f9e28b4-c01e-00a2-0d4d-4e9948000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:0f9e28b4-c01e-00a2-0d4d-4e9948000000\nTime:2020-06-29T19:46:13.1023701Z", + "Date" : "Mon, 29 Jun 2020 19:46:12 GMT", + "x-ms-client-request-id" : "63bcb1fa-4740-4dee-894c-be6691ebf8c0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata196747e58e60b41a2645d4?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "41e8e88b-7f70-4c8e-86b9-12c9d6888906" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C651467AF50", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "12d6dd8f-201e-00ec-4a4d-4e5cad000000", + "Date" : "Mon, 29 Jun 2020 19:46:12 GMT", + "x-ms-client-request-id" : "41e8e88b-7f70-4c8e-86b9-12c9d6888906" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata272618ac80c21c9cbe47f5?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "44a50224-1e3a-4823-9a44-cf6454bacb42" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "fa3f7bcf-701e-0137-6a4d-4ebe2e000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:fa3f7bcf-701e-0137-6a4d-4ebe2e000000\nTime:2020-06-29T19:46:13.4434999Z", + "Date" : "Mon, 29 Jun 2020 19:46:12 GMT", + "x-ms-client-request-id" : "44a50224-1e3a-4823-9a44-cf6454bacb42", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata272618ac80c21c9cbe47f5?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "204aacd3-de14-4c33-af35-29d321b473c7" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C65149B277B", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d18f3c42-a01e-00b9-334d-4eb7da000000", + "Date" : "Mon, 29 Jun 2020 19:46:13 GMT", + "x-ms-client-request-id" : "204aacd3-de14-4c33-af35-29d321b473c7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata196747e58e60b41a2645d4?prefix=javablobsetattributesmetadata3748048f5c4070dd334c&delimiter=/&maxresults=2&include=metadata&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "dd23ddab-10b5-4d2d-ac63-dac127504d2a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "98e7a47e-f01e-0000-6d4d-4e54d4000000", + "Body" : "javablobsetattributesmetadata3748048f5c4070dd334c2/", + "Date" : "Mon, 29 Jun 2020 19:46:12 GMT", + "x-ms-client-request-id" : "dd23ddab-10b5-4d2d-ac63-dac127504d2a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata196747e58e60b41a2645d4/javablobsetattributesmetadata3748048f5c4070dd334c", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "81f7ed01-89bb-4dbb-9822-196b2d4585d7", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "AAAAAAAAAAA=", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:46:13 GMT", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "ETag" : "0x8D81C6514CC17F8", + "Content-Length" : "0", + "x-ms-request-id" : "5e6559e7-d01e-013a-2c4d-4e5122000000", + "x-ms-client-request-id" : "81f7ed01-89bb-4dbb-9822-196b2d4585d7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata196747e58e60b41a2645d4/javablobsetattributesmetadata3748048f5c4070dd334c?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "f5be4230-e13b-4949-97a7-e5a382ce53a5" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6514E48684", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "93f0515d-d01e-0058-484d-4e50af000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:46:13 GMT", + "x-ms-client-request-id" : "f5be4230-e13b-4949-97a7-e5a382ce53a5" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata196747e58e60b41a2645d4/javablobsetattributesmetadata3748048f5c4070dd334c", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "271baa3a-639e-4bdd-bcb9-75c4da19f8ec" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:14 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:46:13 GMT", + "x-ms-meta-foo" : "bar", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "0x8D81C6514E48684", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:46:13 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "a736c263-e01e-011b-6e4d-4e3c13000000", + "x-ms-meta-fizz" : "buzz", + "x-ms-client-request-id" : "271baa3a-639e-4bdd-bcb9-75c4da19f8ec", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcsetattributesmetadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "27679aa2-a967-4a89-9790-9d19dc4c8971" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e0822f65-901e-0039-524d-4e1470000000", + "Body" : "jtcsetattributesmetadatajtcsetattributesmetadata196747e58e60b41a2645d4Mon, 29 Jun 2020 19:46:13 GMT\"0x8D81C651467AF50\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsetattributesmetadata272618ac80c21c9cbe47f5Mon, 29 Jun 2020 19:46:13 GMT\"0x8D81C65149B277B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:46:14 GMT", + "x-ms-client-request-id" : "27679aa2-a967-4a89-9790-9d19dc4c8971", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata196747e58e60b41a2645d4?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "56ed206e-2f80-4baf-84d7-b51e11e2cd6b" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d026ad7b-a01e-00d4-074d-4e1df4000000", + "Date" : "Mon, 29 Jun 2020 19:46:14 GMT", + "x-ms-client-request-id" : "56ed206e-2f80-4baf-84d7-b51e11e2cd6b" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata272618ac80c21c9cbe47f5?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "9bc5588c-a535-43b6-8e6c-8ed1b08c4b92" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d69336ed-701e-011e-704d-4ec86c000000", + "Date" : "Mon, 29 Jun 2020 19:46:14 GMT", + "x-ms-client-request-id" : "9bc5588c-a535-43b6-8e6c-8ed1b08c4b92" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetattributesmetadata0478544438f0549bad48d4", "jtcsetattributesmetadata196747e58e60b41a2645d4", "jtcsetattributesmetadata272618ac80c21c9cbe47f5", "javablobsetattributesmetadata3748048f5c4070dd334c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesmetadata[2].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesmetadata[2].json new file mode 100644 index 000000000000..d33041f1cdf3 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributesmetadata[2].json @@ -0,0 +1,250 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata141366e01eb71353304929?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "6e9c5ee1-196a-4d0c-81d5-fa0aebbe9de0" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "c56e1f54-101e-012c-4b4d-4e90bc000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:c56e1f54-101e-012c-4b4d-4e90bc000000\nTime:2020-06-29T19:46:14.9113988Z", + "Date" : "Mon, 29 Jun 2020 19:46:14 GMT", + "x-ms-client-request-id" : "6e9c5ee1-196a-4d0c-81d5-fa0aebbe9de0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata141366e01eb71353304929?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "89f8dcda-62f0-457a-bfc4-b468628cc137" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C65157C1E76", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "4ed79c4c-901e-005f-294d-4ea62a000000", + "Date" : "Mon, 29 Jun 2020 19:46:14 GMT", + "x-ms-client-request-id" : "89f8dcda-62f0-457a-bfc4-b468628cc137" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata2146885d426326a3664511?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "94a00740-7281-440f-affd-3ef1ab40e59c" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "85bf0f9b-a01e-0135-244d-4ebcd4000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:85bf0f9b-a01e-0135-244d-4ebcd4000000\nTime:2020-06-29T19:46:15.2443686Z", + "Date" : "Mon, 29 Jun 2020 19:46:14 GMT", + "x-ms-client-request-id" : "94a00740-7281-440f-affd-3ef1ab40e59c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata2146885d426326a3664511?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "83b395b4-5cc1-42fa-8527-aa4f3f32198d" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6515AE8A69", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "38152eca-b01e-008f-3d4d-4e1a88000000", + "Date" : "Mon, 29 Jun 2020 19:46:14 GMT", + "x-ms-client-request-id" : "83b395b4-5cc1-42fa-8527-aa4f3f32198d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata141366e01eb71353304929?prefix=javablobsetattributesmetadata3672317595b94457274d&delimiter=/&maxresults=2&include=metadata&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "354153d1-6a90-4692-a214-c2ca1d4db14a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "fc022a6a-101e-00c6-354d-4e29e8000000", + "Body" : "javablobsetattributesmetadata3672317595b94457274d2/", + "Date" : "Mon, 29 Jun 2020 19:46:14 GMT", + "x-ms-client-request-id" : "354153d1-6a90-4692-a214-c2ca1d4db14a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata141366e01eb71353304929/javablobsetattributesmetadata3672317595b94457274d", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "06e66a70-5b32-4d09-9c34-e385927b4001", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "AAAAAAAAAAA=", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:46:15 GMT", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "ETag" : "0x8D81C6515DCF781", + "Content-Length" : "0", + "x-ms-request-id" : "963e2eb3-501e-00e8-514d-4ea92f000000", + "x-ms-client-request-id" : "06e66a70-5b32-4d09-9c34-e385927b4001" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata141366e01eb71353304929/javablobsetattributesmetadata3672317595b94457274d?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "b5b8ac5e-57aa-4b92-bbff-0fee475f7f78" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6515F3B80A", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8d3601e6-701e-001a-6a4d-4e7bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:46:15 GMT", + "x-ms-client-request-id" : "b5b8ac5e-57aa-4b92-bbff-0fee475f7f78" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata141366e01eb71353304929/javablobsetattributesmetadata3672317595b94457274d", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "a4e05a8a-a29c-44aa-909e-5f24db1e8a69" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:15 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-meta-i_" : "a", + "Date" : "Mon, 29 Jun 2020 19:46:15 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "0x8D81C6515F3B80A", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:46:15 GMT", + "Content-Length" : "0", + "x-ms-meta-i0" : "a", + "x-ms-request-id" : "b4678826-e01e-0079-6c4d-4e3d9e000000", + "x-ms-client-request-id" : "a4e05a8a-a29c-44aa-909e-5f24db1e8a69", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcsetattributesmetadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "4ef005c7-a1f8-4c78-81ac-70288fc47e8a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8de971c6-601e-00af-154d-4e7644000000", + "Body" : "jtcsetattributesmetadatajtcsetattributesmetadata141366e01eb71353304929Mon, 29 Jun 2020 19:46:15 GMT\"0x8D81C65157C1E76\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsetattributesmetadata2146885d426326a3664511Mon, 29 Jun 2020 19:46:15 GMT\"0x8D81C6515AE8A69\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:46:16 GMT", + "x-ms-client-request-id" : "4ef005c7-a1f8-4c78-81ac-70288fc47e8a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata141366e01eb71353304929?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "2537a2c9-357a-4b80-9d71-32fcefae7c83" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5bb8a62-101e-0082-024d-4ef584000000", + "Date" : "Mon, 29 Jun 2020 19:46:15 GMT", + "x-ms-client-request-id" : "2537a2c9-357a-4b80-9d71-32fcefae7c83" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributesmetadata2146885d426326a3664511?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "a763c0b9-16ad-4d4f-b9b2-2a93de9253b1" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9b47d6cc-601e-00e0-014d-4eb25c000000", + "Date" : "Mon, 29 Jun 2020 19:46:16 GMT", + "x-ms-client-request-id" : "a763c0b9-16ad-4d4f-b9b2-2a93de9253b1" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetattributesmetadata07353875b964b6b2b944a8", "jtcsetattributesmetadata141366e01eb71353304929", "jtcsetattributesmetadata2146885d426326a3664511", "javablobsetattributesmetadata3672317595b94457274d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributestier[0].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributestier[0].json new file mode 100644 index 000000000000..8f38ca076108 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributestier[0].json @@ -0,0 +1,245 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributestier176543170d623ad8ca4c8189?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "343963db-741d-42c2-900d-9a40468af16c" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "0aee2122-a01e-00b2-014d-4eafae000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:0aee2122-a01e-00b2-014d-4eafae000000\nTime:2020-06-29T19:46:16.7075047Z", + "Date" : "Mon, 29 Jun 2020 19:46:16 GMT", + "x-ms-client-request-id" : "343963db-741d-42c2-900d-9a40468af16c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributestier176543170d623ad8ca4c8189?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "1418d70a-7466-4ab8-89a7-29497bd59c1f" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C651691AFF7", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "97221a66-b01e-00e9-154d-4ea8d2000000", + "Date" : "Mon, 29 Jun 2020 19:46:16 GMT", + "x-ms-client-request-id" : "1418d70a-7466-4ab8-89a7-29497bd59c1f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributestier230215e86c170cccf34365ad?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "8b538eeb-405e-4d59-aa70-5005931f1885" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "f3a61ec8-901e-011f-364d-4ec991000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:f3a61ec8-901e-011f-364d-4ec991000000\nTime:2020-06-29T19:46:17.0484707Z", + "Date" : "Mon, 29 Jun 2020 19:46:16 GMT", + "x-ms-client-request-id" : "8b538eeb-405e-4d59-aa70-5005931f1885", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributestier230215e86c170cccf34365ad?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "a1c8f333-0f2c-47d6-aa21-bab60afcf100" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6516C1D0F9", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1ec194f7-001e-0015-1b4d-4e964d000000", + "Date" : "Mon, 29 Jun 2020 19:46:16 GMT", + "x-ms-client-request-id" : "a1c8f333-0f2c-47d6-aa21-bab60afcf100" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributestier176543170d623ad8ca4c8189?prefix=javablobsetattributestier379276d28bd9a0f26a463f&delimiter=/&maxresults=2&include=metadata&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "ed94f1bf-e623-4f27-be72-c681f7b27962" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "5bc8c390-701e-00b0-774d-4ead54000000", + "Body" : "javablobsetattributestier379276d28bd9a0f26a463f2/", + "Date" : "Mon, 29 Jun 2020 19:46:16 GMT", + "x-ms-client-request-id" : "ed94f1bf-e623-4f27-be72-c681f7b27962", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributestier176543170d623ad8ca4c8189/javablobsetattributestier379276d28bd9a0f26a463f", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "fe6f1a5c-ea70-4522-8926-b11f38ef3773", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "AAAAAAAAAAA=", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:46:16 GMT", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "ETag" : "0x8D81C6516F10BB8", + "Content-Length" : "0", + "x-ms-request-id" : "d1893959-e01e-00fa-044d-4e9d33000000", + "x-ms-client-request-id" : "fe6f1a5c-ea70-4522-8926-b11f38ef3773" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributestier176543170d623ad8ca4c8189/javablobsetattributestier379276d28bd9a0f26a463f?comp=tier", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "3d29e599-ffb6-4d7a-a43b-254097a838f9" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2dcb72f0-501e-0109-694d-4e080f000000", + "Date" : "Mon, 29 Jun 2020 19:46:17 GMT", + "x-ms-client-request-id" : "3d29e599-ffb6-4d7a-a43b-254097a838f9" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributestier176543170d623ad8ca4c8189/javablobsetattributestier379276d28bd9a0f26a463f", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "8134e33f-9bb8-4966-968f-758e61905b21" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:17 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Mon, 29 Jun 2020 19:46:17 GMT", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:46:17 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "0x8D81C6516F10BB8", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:46:17 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "7c7684a6-d01e-00db-604d-4ef002000000", + "x-ms-client-request-id" : "8134e33f-9bb8-4966-968f-758e61905b21", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcsetattributestier&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "499441a9-ee83-46fa-9257-b4b15a2c08a8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e900f6eb-c01e-0125-1e4d-4e8a32000000", + "Body" : "jtcsetattributestierjtcsetattributestier176543170d623ad8ca4c8189Mon, 29 Jun 2020 19:46:16 GMT\"0x8D81C651691AFF7\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsetattributestier230215e86c170cccf34365adMon, 29 Jun 2020 19:46:17 GMT\"0x8D81C6516C1D0F9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:46:17 GMT", + "x-ms-client-request-id" : "499441a9-ee83-46fa-9257-b4b15a2c08a8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributestier176543170d623ad8ca4c8189?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "546fe4ee-05e6-40db-9ee4-1a17f9142724" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "1f0d2206-301e-00bc-4f4d-4e43a5000000", + "Date" : "Mon, 29 Jun 2020 19:46:17 GMT", + "x-ms-client-request-id" : "546fe4ee-05e6-40db-9ee4-1a17f9142724" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributestier230215e86c170cccf34365ad?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "58bc7106-354b-4eff-86fa-f6ee1118e5fe" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "162fbf69-401e-00de-764d-4e047d000000", + "Date" : "Mon, 29 Jun 2020 19:46:17 GMT", + "x-ms-client-request-id" : "58bc7106-354b-4eff-86fa-f6ee1118e5fe" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetattributestier0081433bee3e6eb21548bca1", "jtcsetattributestier176543170d623ad8ca4c8189", "jtcsetattributestier230215e86c170cccf34365ad", "javablobsetattributestier379276d28bd9a0f26a463f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributestier[1].json b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributestier[1].json new file mode 100644 index 000000000000..cd3c0b1e0631 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/test/resources/session-records/AzureFileSystemProviderTestsetattributestier[1].json @@ -0,0 +1,245 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributestier1265167a3a4062e6f84979ba?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "1ea3fde9-fd0b-4d4f-a58f-863385ae7f9b" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "d5b2a734-c01e-004c-014d-4e93cb000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:d5b2a734-c01e-004c-014d-4e93cb000000\nTime:2020-06-29T19:46:18.5968275Z", + "Date" : "Mon, 29 Jun 2020 19:46:17 GMT", + "x-ms-client-request-id" : "1ea3fde9-fd0b-4d4f-a58f-863385ae7f9b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributestier1265167a3a4062e6f84979ba?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "62dc58f1-ddc4-450f-a8ec-47c7cb511b62" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6517AF36C5", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "73228f54-e01e-005b-6d4d-4e53a8000000", + "Date" : "Mon, 29 Jun 2020 19:46:17 GMT", + "x-ms-client-request-id" : "62dc58f1-ddc4-450f-a8ec-47c7cb511b62" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributestier2335647de98cc16afc4b5f93?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "f82e977d-4e03-4b90-b252-c2bae2cb02b1" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "efaf363c-401e-0019-3c4d-4e78bc000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:efaf363c-401e-0019-3c4d-4e78bc000000\nTime:2020-06-29T19:46:18.9259593Z", + "Date" : "Mon, 29 Jun 2020 19:46:18 GMT", + "x-ms-client-request-id" : "f82e977d-4e03-4b90-b252-c2bae2cb02b1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributestier2335647de98cc16afc4b5f93?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "f9ad87ef-0ae4-4d40-9a93-fe86c46b5d3f" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D81C6517DFA2C4", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7cd9e1c7-001e-0078-1b4d-4e3c63000000", + "Date" : "Mon, 29 Jun 2020 19:46:18 GMT", + "x-ms-client-request-id" : "f9ad87ef-0ae4-4d40-9a93-fe86c46b5d3f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributestier1265167a3a4062e6f84979ba?prefix=javablobsetattributestier357352b9c3df5a075948bf&delimiter=/&maxresults=2&include=metadata&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "799f1998-fe71-4ca1-ac83-73a72bf5d4e0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b45a2cc4-601e-000e-674d-4eb8df000000", + "Body" : "javablobsetattributestier357352b9c3df5a075948bf2/", + "Date" : "Mon, 29 Jun 2020 19:46:19 GMT", + "x-ms-client-request-id" : "799f1998-fe71-4ca1-ac83-73a72bf5d4e0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributestier1265167a3a4062e6f84979ba/javablobsetattributestier357352b9c3df5a075948bf", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "62296a57-60da-42ca-91f0-2cc2aa8b8b3d", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "AAAAAAAAAAA=", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 29 Jun 2020 19:46:18 GMT", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "ETag" : "0x8D81C65180FD041", + "Content-Length" : "0", + "x-ms-request-id" : "3d82ed59-f01e-0044-654d-4e88b8000000", + "x-ms-client-request-id" : "62296a57-60da-42ca-91f0-2cc2aa8b8b3d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributestier1265167a3a4062e6f84979ba/javablobsetattributestier357352b9c3df5a075948bf?comp=tier", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "d6e52437-c1c5-49b9-9f7d-a46b844f62e4" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "997a7963-a01e-00df-694d-4e0580000000", + "Date" : "Mon, 29 Jun 2020 19:46:19 GMT", + "x-ms-client-request-id" : "d6e52437-c1c5-49b9-9f7d-a46b844f62e4" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributestier1265167a3a4062e6f84979ba/javablobsetattributestier357352b9c3df5a075948bf", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "eb6a1802-5771-44da-95a8-67b86a2fcda8" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 29 Jun 2020 19:46:19 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Mon, 29 Jun 2020 19:46:19 GMT", + "StatusCode" : "200", + "Date" : "Mon, 29 Jun 2020 19:46:19 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "Cool", + "ETag" : "0x8D81C65180FD041", + "x-ms-creation-time" : "Mon, 29 Jun 2020 19:46:19 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "e0a7bb31-701e-0115-654d-4ed018000000", + "x-ms-client-request-id" : "eb6a1802-5771-44da-95a8-67b86a2fcda8", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcsetattributestier&comp=list", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "d029cbd1-ca6a-4a8a-a901-7a016ec997b8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "76377f44-f01e-0083-104d-4ef479000000", + "Body" : "jtcsetattributestierjtcsetattributestier1265167a3a4062e6f84979baMon, 29 Jun 2020 19:46:18 GMT\"0x8D81C6517AF36C5\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsetattributestier2335647de98cc16afc4b5f93Mon, 29 Jun 2020 19:46:19 GMT\"0x8D81C6517DFA2C4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 29 Jun 2020 19:46:19 GMT", + "x-ms-client-request-id" : "d029cbd1-ca6a-4a8a-a901-7a016ec997b8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributestier1265167a3a4062e6f84979ba?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "23b242d9-2a1c-4117-8c8f-c8fab0e18952" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b59cc5f7-a01e-007e-644d-4ecb1b000000", + "Date" : "Mon, 29 Jun 2020 19:46:19 GMT", + "x-ms-client-request-id" : "23b242d9-2a1c-4117-8c8f-c8fab0e18952" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.blob.core.windows.net/jtcsetattributestier2335647de98cc16afc4b5f93?restype=container", + "Headers" : { + "x-ms-version" : "2019-07-07", + "User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "8a1a28a7-04bb-4779-8df9-7c3e0c49b57c" + }, + "Response" : { + "x-ms-version" : "2019-07-07", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b86012a1-801e-008c-394d-4e198f000000", + "Date" : "Mon, 29 Jun 2020 19:46:19 GMT", + "x-ms-client-request-id" : "8a1a28a7-04bb-4779-8df9-7c3e0c49b57c" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetattributestier024530bf4858d2ab9147a68c", "jtcsetattributestier1265167a3a4062e6f84979ba", "jtcsetattributestier2335647de98cc16afc4b5f93", "javablobsetattributestier357352b9c3df5a075948bf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/CHANGELOG.md b/sdk/storage/azure-storage-blob/CHANGELOG.md index 5391c541489b..3b4cc6ce59c2 100644 --- a/sdk/storage/azure-storage-blob/CHANGELOG.md +++ b/sdk/storage/azure-storage-blob/CHANGELOG.md @@ -1,6 +1,9 @@ # Release History -## 12.8.0-beta.1 (Unreleased) +## 12.8.0-beta.2 (Unreleased) + + +## 12.8.0-beta.1 (2020-07-07) - Added support for the 2019-12-12 service version. - Added support for blob tags. Added get/setTags method to Blob(Async)ClientBase. Added filterTags api to BlobServiceClient. Added ability to specify tags on all methods that create a blob. Tag count returned on getProperties/getBlob. Option to include returning tags on listing. - Added support to query a blob. Added query and opernQueryInputStream methods to Blob(Async)ClientBase. diff --git a/sdk/storage/azure-storage-blob/README.md b/sdk/storage/azure-storage-blob/README.md index 30c9e6152136..4747ec49284c 100644 --- a/sdk/storage/azure-storage-blob/README.md +++ b/sdk/storage/azure-storage-blob/README.md @@ -22,7 +22,7 @@ definition, such as text or binary data. com.azure azure-storage-blob - 12.7.0 + 12.8.0-beta.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/storage/azure-storage-blob/pom.xml b/sdk/storage/azure-storage-blob/pom.xml index 90a19dbf5006..17c0c68fa1aa 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.8.0-beta.1 + 12.8.0-beta.2 Microsoft Azure client library for Blob Storage This module contains client library for Microsoft Azure Blob Storage. @@ -55,17 +55,17 @@ com.azure azure-core - 1.6.0 + 1.7.0-beta.1 com.azure azure-storage-common - 12.8.0-beta.1 + 12.8.0-beta.2 com.azure azure-storage-internal-avro - 12.0.0-beta.1 + 12.0.0-beta.2 + 1.0.8 test
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java index a0ea19070301..8e412393564c 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java @@ -343,11 +343,9 @@ private Mono listBlobContainersSegmen null, null, Context.NONE), timeout); } - - // TODO: (rickle-msft) doc links /** * Returns a reactive Publisher emitting the blobs in this account whose tags match the query expression. For more - * information, including information on the query syntax, see the Azure Docs. + * information, including information on the query syntax, see the Azure Docs. * *

Code Samples

* @@ -362,7 +360,7 @@ public PagedFlux findBlobsByTags(String query) { /** * Returns a reactive Publisher emitting the blobs in this account whose tags match the query expression. For more - * information, including information on the query syntax, see the Azure Docs. + * information, including information on the query syntax, see the Azure Docs. * *

Code Samples

* diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java index 6e50941a7a2a..2088971f76c5 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java @@ -195,11 +195,10 @@ public PagedIterable listBlobContainers(ListBlobContainersOpt return new PagedIterable<>(blobServiceAsyncClient.listBlobContainersWithOptionalTimeout(options, timeout)); } - // TODO: (rickle-msft) doc links /** * Returns a lazy loaded list of blobs in this account whose tags match the query expression. The returned * {@link PagedIterable} can be consumed while new items are automatically retrieved as needed. For more - * information, including information on the query syntax, see the Azure Docs. + * information, including information on the query syntax, see the Azure Docs. * *

Code Samples

* @@ -215,7 +214,7 @@ public PagedIterable findBlobsByTags(String query) { /** * Returns a lazy loaded list of blobs in this account whose tags match the query expression. The returned * {@link PagedIterable} can be consumed while new items are automatically retrieved as needed. For more - * information, including information on the query syntax, see the Azure Docs. + * information, including information on the query syntax, see the Azure Docs. * *

Code Samples

* diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java index b9dbda523c82..031786dc772e 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java @@ -1338,7 +1338,6 @@ Mono> setMetadataWithResponse(Map metadata, BlobR .map(response -> new SimpleResponse<>(response, null)); } - // TODO: (rickle-msft) docs link /** * Returns the blob's tags. * @@ -1347,7 +1346,7 @@ Mono> setMetadataWithResponse(Map metadata, BlobR * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.getTags} * *

For more information, see the - * Azure Docs

+ * Azure Docs

* * @return A reactive response containing the blob's tags. */ @@ -1363,7 +1362,7 @@ public Mono> getTags() { * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.getTagsWithResponse} * *

For more information, see the - * Azure Docs

+ * Azure Docs

* * @return A reactive response containing the blob's tags. */ @@ -1396,7 +1395,7 @@ Mono>> getTagsWithResponse(Context context) { * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.setTags#Map} * *

For more information, see the - * Azure Docs

+ * Azure Docs

* * @param tags Tags to associate with the blob. * @return A reactive response signaling completion. @@ -1414,7 +1413,7 @@ public Mono setTags(Map tags) { * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.setTagsWithResponse#Map} * *

For more information, see the - * Azure Docs

+ * Azure Docs

* * @param tags Tags to associate with the blob. * @return A reactive response signaling completion. @@ -1694,12 +1693,11 @@ public String generateSas(BlobServiceSasSignatureValues blobServiceSasSignatureV .generateSas(SasImplUtils.extractSharedKeyCredential(getHttpPipeline())); } - /* TODO (gapra): Quick Query service docs. */ /** * Queries the entire blob. * *

For more information, see the - * Azure Docs

+ * Azure Docs

* *

Code Samples

* @@ -1717,7 +1715,7 @@ public Flux query(String expression) { * Queries the entire blob. * *

For more information, see the - * Azure Docs

+ * Azure Docs

* *

Code Samples

* diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobClientBase.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobClientBase.java index 3adaee92bd34..093220f8b91c 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobClientBase.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobClientBase.java @@ -785,7 +785,6 @@ public Response setMetadataWithResponse(Map metadata, Blob return blockWithOptionalTimeout(response, timeout); } - // TODO: (rickle-msft) docs link /** * Returns the blob's tags. * @@ -794,7 +793,7 @@ public Response setMetadataWithResponse(Map metadata, Blob * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.getTags} * *

For more information, see the - * Azure Docs

+ * Azure Docs

* * @return The blob's tags. */ @@ -810,7 +809,7 @@ public Map getTags() { * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.getTagsWithResponse#Duration-Context} * *

For more information, see the - * Azure Docs

+ * Azure Docs

* * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @param context Additional context that is passed through the Http pipeline during the service call. @@ -831,7 +830,7 @@ public Response> getTagsWithResponse(Duration timeout, Conte * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.setTags#Map} * *

For more information, see the - * Azure Docs

+ * Azure Docs

* * @param tags Tags to associate with the blob. */ @@ -848,7 +847,7 @@ public void setTags(Map tags) { * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.setTagsWithResponse#Map-Duration-Context} * *

For more information, see the - * Azure Docs

+ * Azure Docs

* * @param tags Tags to associate with the blob. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. @@ -1055,12 +1054,11 @@ public String generateSas(BlobServiceSasSignatureValues blobServiceSasSignatureV return this.client.generateSas(blobServiceSasSignatureValues); } - /* TODO (gapra): Populate Rest Api docs for quick query. */ /** * Opens a blob input stream to query the blob. * *

For more information, see the - * Azure Docs

+ * Azure Docs

* *

Code Samples

* @@ -1077,7 +1075,7 @@ public InputStream openQueryInputStream(String expression) { * Opens a blob input stream to query the blob. * *

For more information, see the - * Azure Docs

+ * Azure Docs

* *

Code Samples

* @@ -1102,7 +1100,7 @@ public InputStream openQueryInputStream(BlobQueryOptions queryOptions) { * Queries an entire blob into an output stream. * *

For more information, see the - * Azure Docs

+ * Azure Docs

* *

Code Samples

* @@ -1121,7 +1119,7 @@ public void query(OutputStream stream, String expression) { * Queries an entire blob into an output stream. * *

For more information, see the - * Azure Docs

+ * Azure Docs

* *

Code Samples

* diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/LargeBlobTest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/LargeBlobTest.groovy index 74f70f000a18..9fde87c654e4 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/LargeBlobTest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/LargeBlobTest.groovy @@ -122,6 +122,7 @@ class LargeBlobTest extends APISpec { } @Requires({ liveMode() }) + @Ignore("IS mark/reset") // This test does not send large payload over the wire def "Upload Large Blob in Single Upload"() { given: @@ -140,6 +141,7 @@ class LargeBlobTest extends APISpec { } @Requires({ liveMode() }) + @Ignore("OOM") // This test does not send large payload over the wire def "Upload Large Blob in Single Upload Async"() { given: @@ -156,6 +158,7 @@ class LargeBlobTest extends APISpec { } @Requires({ liveMode() }) + @Ignore("IS mark/reset") // This test does not send large payload over the wire def "Stage Large Blob"() { given: @@ -172,6 +175,7 @@ class LargeBlobTest extends APISpec { } @Requires({ liveMode() }) + @Ignore("OOM") // This test does not send large payload over the wire def "Upload Large Input"() { given: @@ -209,6 +213,7 @@ class LargeBlobTest extends APISpec { } @Requires({ liveMode() }) + @Ignore("IS mark/reset") // This test does not send large payload over the wire def "Upload Large Input Sync"() { given: diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/VersioningTest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/VersioningTest.groovy index 4c377dbc5d8a..54b31b8a57a3 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/VersioningTest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/VersioningTest.groovy @@ -30,7 +30,7 @@ class VersioningTest extends APISpec { def setup() { blobName = generateBlobName() containerName = generateContainerName() - blobContainerClient = versionedBlobServiceClient.createBlobContainer(containerName) + blobContainerClient = primaryBlobServiceClient.createBlobContainer(containerName) blobClient = blobContainerClient.getBlobClient(blobName) } diff --git a/sdk/storage/azure-storage-common/CHANGELOG.md b/sdk/storage/azure-storage-common/CHANGELOG.md index d8786f7f65a4..c46970cb89f5 100644 --- a/sdk/storage/azure-storage-common/CHANGELOG.md +++ b/sdk/storage/azure-storage-common/CHANGELOG.md @@ -1,6 +1,11 @@ # Release History -## 12.8.0-beta.1 (Unreleased) +## 12.8.0-beta.2 (Unreleased) + + +## 12.8.0-beta.1 (2020-07-07) +- Added support for the 2019-12-12 service version. +- Buffered UploadUtils now supports uploading data of long sized length. ## 12.7.0 (2020-06-12) - Updated azure-core dependency. diff --git a/sdk/storage/azure-storage-common/README.md b/sdk/storage/azure-storage-common/README.md index 85bed911da47..cbe4d7e5a151 100644 --- a/sdk/storage/azure-storage-common/README.md +++ b/sdk/storage/azure-storage-common/README.md @@ -18,7 +18,7 @@ Azure Storage Common is a library that has common dependencies for all Azure Sto com.azure azure-storage-common - 12.7.0 + 12.8.0-beta.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/storage/azure-storage-common/pom.xml b/sdk/storage/azure-storage-common/pom.xml index a3503e01608c..ed5c8dc11b46 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.8.0-beta.1 + 12.8.0-beta.2 Microsoft Azure common module for Storage This module contains common code based for all Microsoft Azure Storage client libraries. @@ -41,7 +41,7 @@ com.azure azure-core - 1.6.0 + 1.7.0-beta.1 com.azure @@ -68,7 +68,7 @@ com.azure azure-identity - 1.0.7 + 1.0.8 test diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/PayloadSizeGate.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/PayloadSizeGate.java index ba8be907702c..806fa97e5496 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/PayloadSizeGate.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/PayloadSizeGate.java @@ -66,7 +66,8 @@ Flux write(ByteBuffer buf) { */ Flux flush() { if (byteBuffers != null) { - Flux result = dequeuingFlux(byteBuffers); + // We return Flux from iterable in this case to support retries on single upload. + Flux result = Flux.fromIterable(byteBuffers); byteBuffers = null; return result; } else { diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/UploadBufferPool.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/UploadBufferPool.java index 96222f808bd7..b4590afc123e 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/UploadBufferPool.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/UploadBufferPool.java @@ -112,10 +112,11 @@ public Flux write(ByteBuffer buf) { // We will overflow the current buffer and require another one. // Duplicate and adjust the window of buf so that we fill up currentBuf without going out of bounds. ByteBuffer duplicate = buf.duplicate(); - duplicate.limit(buf.position() + (int) this.currentBuf.remainingCapacity()); + int newLimit = buf.position() + (int) this.currentBuf.remainingCapacity(); + duplicate.limit(newLimit); this.currentBuf.append(duplicate); // Adjust the window of original buffer to represent remaining part. - buf.position(buf.position() + (int) this.currentBuf.remainingCapacity()); + buf.position(newLimit); result = Flux.just(this.currentBuf); diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/UploadUtils.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/UploadUtils.java index 6c0611d3363b..6c97ce64d2f0 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/UploadUtils.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/UploadUtils.java @@ -44,14 +44,18 @@ public static Mono> uploadFullOrChunked(final Flux d .filter(ByteBuffer::hasRemaining) // The gate buffers data until threshold is breached. .concatMap(gate::write) - .concatWith(Flux.defer(gate::flush)) // First buffer is emitted after threshold is breached or there's no more data. // Therefore we can make a decision how to upload data on first element. .switchOnFirst((signal, flux) -> { if (gate.isThresholdBreached()) { - return uploadInChunks.apply(flux); + // In this case we can pass a flux that can have just one subscriber because + // the chunked upload is going to cache the data downstream before sending chunks over the wire. + return uploadInChunks.apply(flux.concatWith(Flux.defer(gate::flush))); } else { - return uploadFull.apply(flux, gate.size()); + // In this case gate contains all the data cached. + // The flux passed to this lambda allows only one subscriber. Therefore we substitute it + // with flux coming from gate which is based of iterable and can be subscribed again. + return uploadFull.apply(gate.flush(), gate.size()); } }) .next() diff --git a/sdk/storage/azure-storage-common/src/test/java/com/azure/storage/common/implementation/FluxInputStreamTest.groovy b/sdk/storage/azure-storage-common/src/test/java/com/azure/storage/common/implementation/FluxInputStreamTest.groovy index 41130554fd52..c58c1e1ac3b5 100644 --- a/sdk/storage/azure-storage-common/src/test/java/com/azure/storage/common/implementation/FluxInputStreamTest.groovy +++ b/sdk/storage/azure-storage-common/src/test/java/com/azure/storage/common/implementation/FluxInputStreamTest.groovy @@ -13,6 +13,13 @@ import java.nio.ByteBuffer class FluxInputStreamTest extends Specification { + def setup() { + String fullTestName = specificationContext.getCurrentIteration().getName().replace(' ', '').toLowerCase() + String className = specificationContext.getCurrentSpec().getName() + // Print out the test name to create breadcrumbs in our test logging in case anything hangs. + System.out.printf("========================= %s.%s =========================%n", className, fullTestName) + } + /* Network tests to be performed by implementors of the FluxInputStream. */ Flux generateData(int num) { List buffers = new ArrayList<>() diff --git a/sdk/storage/azure-storage-file-datalake/CHANGELOG.md b/sdk/storage/azure-storage-file-datalake/CHANGELOG.md index 881d9af7cbdc..136b79699aca 100644 --- a/sdk/storage/azure-storage-file-datalake/CHANGELOG.md +++ b/sdk/storage/azure-storage-file-datalake/CHANGELOG.md @@ -1,7 +1,12 @@ # Release History -## 12.2.0-beta.1 (Unreleased) +## 12.2.0-beta.2 (Unreleased) + + +## 12.2.0-beta.1 (2019-07-07) +- Added support for the 2019-12-12 service version. - Added support to query a file. +- Added support to increase the maximum size of data that can be sent via an append. ## 12.1.2 (2020-06-12) - Updated azure-storage-common and azure-core dependencies. diff --git a/sdk/storage/azure-storage-file-datalake/README.md b/sdk/storage/azure-storage-file-datalake/README.md index c9323487b20f..dab5875941e1 100644 --- a/sdk/storage/azure-storage-file-datalake/README.md +++ b/sdk/storage/azure-storage-file-datalake/README.md @@ -25,7 +25,7 @@ Add a dependency on Azure Storage File Datalake com.azure azure-storage-file-datalake - 12.1.2 + 12.2.0-beta.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/storage/azure-storage-file-datalake/pom.xml b/sdk/storage/azure-storage-file-datalake/pom.xml index 588d783e1202..6ccc6e418a33 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.2.0-beta.1 + 12.2.0-beta.2 Microsoft Azure client library for File Storage Data Lake This module contains client library for Microsoft Azure File Storage Data Lake. @@ -55,7 +55,7 @@ com.azure azure-storage-blob - 12.8.0-beta.1 + 12.8.0-beta.2 + 1.0.8 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 431d5b006eb0..0139c0e2fdf8 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 @@ -885,12 +885,11 @@ public Mono> renameWithResponse(String destina } } - /* TODO (gapra): Service docs*/ /** * Queries the entire file. * *

For more information, see the - * Azure Docs

+ * Azure Docs

* *

Code Samples

* @@ -908,7 +907,7 @@ public Flux query(String expression) { * Queries the entire file. * *

For more information, see the - * Azure Docs

+ * Azure Docs

* *

Code Samples

* diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileClient.java index 41e0fa269764..9a70956e97bd 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileClient.java @@ -554,12 +554,11 @@ public Response renameWithResponse(String destinationFileSys return new SimpleResponse<>(resp, new DataLakeFileClient(resp.getValue())); } - /* TODO (gapra): Populate Rest Api docs for quick query. */ /** * Opens an input stream to query the file. * *

For more information, see the - * Azure Docs

+ * Azure Docs

* *

Code Samples

* @@ -576,7 +575,7 @@ public InputStream openQueryInputStream(String expression) { * Opens an input stream to query the file. * *

For more information, see the - * Azure Docs

+ * Azure Docs

* *

Code Samples

* @@ -602,7 +601,7 @@ public InputStream openQueryInputStream(FileQueryOptions queryOptions) { * Queries an entire file into an output stream. * *

For more information, see the - * Azure Docs

+ * Azure Docs

* *

Code Samples

* @@ -621,7 +620,7 @@ public void query(OutputStream stream, String expression) { * Queries an entire file into an output stream. * *

For more information, see the - * Azure Docs

+ * Azure Docs

* *

Code Samples

* diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/LargeFileTest.groovy b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/LargeFileTest.groovy index 43ae5b68b510..00097b8c9f65 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/LargeFileTest.groovy +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/LargeFileTest.groovy @@ -9,8 +9,6 @@ import com.azure.storage.common.ParallelTransferOptions import com.azure.storage.common.implementation.Constants import com.azure.storage.common.policy.StorageSharedKeyCredentialPolicy import com.azure.storage.file.datalake.models.DataLakeStorageException -import org.reactivestreams.Publisher -import org.reactivestreams.Subscriber import reactor.core.publisher.Flux import reactor.core.publisher.Mono import spock.lang.Ignore diff --git a/sdk/storage/azure-storage-file-share/CHANGELOG.md b/sdk/storage/azure-storage-file-share/CHANGELOG.md index ef5467fc518b..635e71d9cbc5 100644 --- a/sdk/storage/azure-storage-file-share/CHANGELOG.md +++ b/sdk/storage/azure-storage-file-share/CHANGELOG.md @@ -1,6 +1,10 @@ # Release History -## 12.6.0-beta.1 (Unreleased) +## 12.6.0-beta.2 (Unreleased) + + +## 12.6.0-beta.1 (2019-07-07) +- Added support for the 2019-12-12 service version. - Added support for restoring file share. ## 12.5.0 (2020-06-12) diff --git a/sdk/storage/azure-storage-file-share/README.md b/sdk/storage/azure-storage-file-share/README.md index 5579a22bd0d5..92123fc2b244 100644 --- a/sdk/storage/azure-storage-file-share/README.md +++ b/sdk/storage/azure-storage-file-share/README.md @@ -24,7 +24,7 @@ Shares provide a way to organize sets of files and also can be mounted as an SMB com.azure azure-storage-file-share - 12.5.0 + 12.6.0-beta.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/storage/azure-storage-file-share/pom.xml b/sdk/storage/azure-storage-file-share/pom.xml index 65406ba22e7f..c67aa9e98604 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.6.0-beta.1 + 12.6.0-beta.2 Microsoft Azure client library for File Share Storage This module contains client library for Microsoft Azure File Share Storage. @@ -36,7 +36,7 @@ com.azure azure-storage-common - 12.8.0-beta.1 + 12.8.0-beta.2 + 12.0.0-beta.2 Microsoft Azure internal Avro module for Storage This module contains internal use only avro parser code based for Microsoft Azure Storage client libraries. @@ -41,7 +41,7 @@ com.azure azure-storage-common - 12.8.0-beta.1 + 12.8.0-beta.2 io.projectreactor @@ -56,4 +56,79 @@ test + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.1.1 + + + attach-javadocs + + jar + + + true + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.1.2 + + + empty-javadoc-jar-with-readme + package + + jar + + + javadoc + ${project.basedir}/javadocTemp + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.8 + + + copy-readme-to-javadocTemp + prepare-package + + + Deleting existing ${project.basedir}/javadocTemp + + + + Copying ${project.basedir}/README.md to + ${project.basedir}/javadocTemp/README.md + + + + + + run + + + + + + + diff --git a/sdk/storage/azure-storage-internal-avro/src/test/java/com/azure/storage/internal/avro/implementation/AvroParserStateTest.groovy b/sdk/storage/azure-storage-internal-avro/src/test/java/com/azure/storage/internal/avro/implementation/AvroParserStateTest.groovy index 9cb273789287..e95e1fb73911 100644 --- a/sdk/storage/azure-storage-internal-avro/src/test/java/com/azure/storage/internal/avro/implementation/AvroParserStateTest.groovy +++ b/sdk/storage/azure-storage-internal-avro/src/test/java/com/azure/storage/internal/avro/implementation/AvroParserStateTest.groovy @@ -8,6 +8,13 @@ import java.nio.ByteBuffer class AvroParserStateTest extends Specification { + def setup() { + String fullTestName = specificationContext.getCurrentIteration().getName().replace(' ', '').toLowerCase() + String className = specificationContext.getCurrentSpec().getName() + // Print out the test name to create breadcrumbs in our test logging in case anything hangs. + System.out.printf("========================= %s.%s =========================%n", className, fullTestName) + } + def "constructor"() { setup: AvroParserState state = new AvroParserState() diff --git a/sdk/storage/azure-storage-internal-avro/src/test/java/com/azure/storage/internal/avro/implementation/AvroReaderTest.groovy b/sdk/storage/azure-storage-internal-avro/src/test/java/com/azure/storage/internal/avro/implementation/AvroReaderTest.groovy index db0c58ab097a..469405860bed 100644 --- a/sdk/storage/azure-storage-internal-avro/src/test/java/com/azure/storage/internal/avro/implementation/AvroReaderTest.groovy +++ b/sdk/storage/azure-storage-internal-avro/src/test/java/com/azure/storage/internal/avro/implementation/AvroReaderTest.groovy @@ -17,6 +17,13 @@ import java.nio.file.StandardOpenOption class AvroReaderTest extends Specification { + def setup() { + String fullTestName = specificationContext.getCurrentIteration().getName().replace(' ', '').toLowerCase() + String className = specificationContext.getCurrentSpec().getName() + // Print out the test name to create breadcrumbs in our test logging in case anything hangs. + System.out.printf("========================= %s.%s =========================%n", className, fullTestName) + } + String getTestCasePath(int testCase) { String fileName = String.format("test_null_%d.avro", testCase) ClassLoader classLoader = getClass().getClassLoader() diff --git a/sdk/storage/azure-storage-internal-avro/src/test/java/com/azure/storage/internal/avro/implementation/AvroSchemaTest.groovy b/sdk/storage/azure-storage-internal-avro/src/test/java/com/azure/storage/internal/avro/implementation/AvroSchemaTest.groovy index 330dd68a2377..731c48bfc941 100644 --- a/sdk/storage/azure-storage-internal-avro/src/test/java/com/azure/storage/internal/avro/implementation/AvroSchemaTest.groovy +++ b/sdk/storage/azure-storage-internal-avro/src/test/java/com/azure/storage/internal/avro/implementation/AvroSchemaTest.groovy @@ -7,6 +7,13 @@ import java.nio.ByteBuffer class AvroSchemaTest extends Specification { + def setup() { + String fullTestName = specificationContext.getCurrentIteration().getName().replace(' ', '').toLowerCase() + String className = specificationContext.getCurrentSpec().getName() + // Print out the test name to create breadcrumbs in our test logging in case anything hangs. + System.out.printf("========================= %s.%s =========================%n", className, fullTestName) + } + def "getBytes"() { setup: ByteBuffer b1 = ByteBuffer.wrap("Hello ".getBytes()) diff --git a/sdk/storage/azure-storage-perf/pom.xml b/sdk/storage/azure-storage-perf/pom.xml index 807c5466a99f..fba784702f28 100644 --- a/sdk/storage/azure-storage-perf/pom.xml +++ b/sdk/storage/azure-storage-perf/pom.xml @@ -27,7 +27,7 @@ com.azure azure-storage-blob - 12.8.0-beta.1 + 12.8.0-beta.2 com.azure diff --git a/sdk/storage/azure-storage-queue/CHANGELOG.md b/sdk/storage/azure-storage-queue/CHANGELOG.md index 35f02e370099..21c3c2865e93 100644 --- a/sdk/storage/azure-storage-queue/CHANGELOG.md +++ b/sdk/storage/azure-storage-queue/CHANGELOG.md @@ -1,6 +1,10 @@ # Release History -## 12.6.0-beta.1 (Unreleased) +## 12.6.0-beta.2 (Unreleased) + + +## 12.6.0-beta.1 (2019-07-07) +- Added support for the 2019-12-12 service version. ## 12.5.2 (2020-06-12) - Updated azure-storage-common and azure-core dependencies. diff --git a/sdk/storage/azure-storage-queue/README.md b/sdk/storage/azure-storage-queue/README.md index 77c5e64a4162..71027ce19a2e 100644 --- a/sdk/storage/azure-storage-queue/README.md +++ b/sdk/storage/azure-storage-queue/README.md @@ -20,7 +20,7 @@ A single queue message can be up to 64 KB in size, and a queue can contain milli com.azure azure-storage-queue - 12.5.2 + 12.6.0-beta.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/storage/azure-storage-queue/pom.xml b/sdk/storage/azure-storage-queue/pom.xml index 2d7394845351..6ac51858d92f 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.6.0-beta.1 + 12.6.0-beta.2 Microsoft Azure client library for Queue Storage This module contains client library for Microsoft Azure Queue Storage. @@ -36,12 +36,12 @@ com.azure azure-core - 1.6.0 + 1.7.0-beta.1 com.azure azure-storage-common - 12.8.0-beta.1 + 12.8.0-beta.2 com.azure @@ -71,7 +71,7 @@ com.azure azure-identity - 1.0.7 + 1.0.8 test diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/StorageManagementClient.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/StorageManagementClient.java index 4613c657d02a..1a25aea6004a 100644 --- a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/StorageManagementClient.java +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/StorageManagementClient.java @@ -8,7 +8,7 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.management.AzureEnvironment; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.AzureServiceClient; +import com.azure.resourcemanager.resources.fluentcore.AzureServiceClient; import com.azure.resourcemanager.storage.fluent.BlobContainersClient; import com.azure.resourcemanager.storage.fluent.BlobServicesClient; import com.azure.resourcemanager.storage.fluent.EncryptionScopesClient; diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/fluent/BlobContainersClient.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/fluent/BlobContainersClient.java index 0093ed602ff8..8f99917e2bc6 100644 --- a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/fluent/BlobContainersClient.java +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/fluent/BlobContainersClient.java @@ -44,7 +44,7 @@ import com.azure.resourcemanager.storage.models.BlobContainersGetImmutabilityPolicyResponse; import com.azure.resourcemanager.storage.models.BlobContainersLockImmutabilityPolicyResponse; import com.azure.resourcemanager.storage.models.LeaseContainerRequest; -import com.azure.resourcemanager.storage.models.ListSharesExpand; +import com.azure.resourcemanager.storage.models.ListContainersInclude; import java.util.List; import reactor.core.publisher.Mono; @@ -90,7 +90,7 @@ Mono> list( @PathParam("subscriptionId") String subscriptionId, @QueryParam("$maxpagesize") String maxpagesize, @QueryParam("$filter") String filter, - @QueryParam("$include") ListSharesExpand include, + @QueryParam("$include") ListContainersInclude include, Context context); @Headers({"Accept: application/json", "Content-Type: application/json"}) @@ -319,7 +319,11 @@ Mono> listNext( */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> listSinglePageAsync( - String resourceGroupName, String accountName, String maxpagesize, String filter, ListSharesExpand include) { + String resourceGroupName, + String accountName, + String maxpagesize, + String filter, + ListContainersInclude include) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -388,7 +392,7 @@ public Mono> listSinglePageAsync( String accountName, String maxpagesize, String filter, - ListSharesExpand include, + ListContainersInclude include, Context context) { if (this.client.getEndpoint() == null) { return Mono @@ -449,7 +453,11 @@ public Mono> listSinglePageAsync( */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listAsync( - String resourceGroupName, String accountName, String maxpagesize, String filter, ListSharesExpand include) { + String resourceGroupName, + String accountName, + String maxpagesize, + String filter, + ListContainersInclude include) { return new PagedFlux<>( () -> listSinglePageAsync(resourceGroupName, accountName, maxpagesize, filter, include), nextLink -> listNextSinglePageAsync(nextLink)); @@ -478,7 +486,7 @@ public PagedFlux listAsync( String accountName, String maxpagesize, String filter, - ListSharesExpand include, + ListContainersInclude include, Context context) { return new PagedFlux<>( () -> listSinglePageAsync(resourceGroupName, accountName, maxpagesize, filter, include, context), @@ -502,7 +510,7 @@ public PagedFlux listAsync( public PagedFlux listAsync(String resourceGroupName, String accountName) { final String maxpagesize = null; final String filter = null; - final ListSharesExpand include = null; + final ListContainersInclude include = null; final Context context = null; return new PagedFlux<>( () -> listSinglePageAsync(resourceGroupName, accountName, maxpagesize, filter, include), @@ -527,7 +535,11 @@ public PagedFlux listAsync(String resourceGroupName, Str */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list( - String resourceGroupName, String accountName, String maxpagesize, String filter, ListSharesExpand include) { + String resourceGroupName, + String accountName, + String maxpagesize, + String filter, + ListContainersInclude include) { return new PagedIterable<>(listAsync(resourceGroupName, accountName, maxpagesize, filter, include)); } @@ -554,7 +566,7 @@ public PagedIterable list( String accountName, String maxpagesize, String filter, - ListSharesExpand include, + ListContainersInclude include, Context context) { return new PagedIterable<>(listAsync(resourceGroupName, accountName, maxpagesize, filter, include, context)); } @@ -576,7 +588,7 @@ public PagedIterable list( public PagedIterable list(String resourceGroupName, String accountName) { final String maxpagesize = null; final String filter = null; - final ListSharesExpand include = null; + final ListContainersInclude include = null; final Context context = null; return new PagedIterable<>(listAsync(resourceGroupName, accountName, maxpagesize, filter, include)); } diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/fluent/ManagementPoliciesClient.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/fluent/ManagementPoliciesClient.java index 4f7c94dc296d..e24a7e0c664b 100644 --- a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/fluent/ManagementPoliciesClient.java +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/fluent/ManagementPoliciesClient.java @@ -24,14 +24,14 @@ import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.resources.fluentcore.collection.InnerSupportsDelete; import com.azure.resourcemanager.storage.StorageManagementClient; import com.azure.resourcemanager.storage.fluent.inner.ManagementPolicyInner; +import com.azure.resourcemanager.storage.models.ManagementPolicyName; import com.azure.resourcemanager.storage.models.ManagementPolicySchema; import reactor.core.publisher.Mono; /** An instance of this class provides access to all the operations defined in ManagementPolicies. */ -public final class ManagementPoliciesClient implements InnerSupportsDelete { +public final class ManagementPoliciesClient { private final ClientLogger logger = new ClientLogger(ManagementPoliciesClient.class); /** The proxy service used to perform REST calls. */ @@ -70,7 +70,7 @@ Mono> get( @PathParam("accountName") String accountName, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("managementPolicyName") String managementPolicyName, + @PathParam("managementPolicyName") ManagementPolicyName managementPolicyName, Context context); @Headers({"Accept: application/json", "Content-Type: application/json"}) @@ -85,7 +85,7 @@ Mono> createOrUpdate( @PathParam("accountName") String accountName, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("managementPolicyName") String managementPolicyName, + @PathParam("managementPolicyName") ManagementPolicyName managementPolicyName, @BodyParam("application/json") ManagementPolicyInner properties, Context context); @@ -101,7 +101,7 @@ Mono> delete( @PathParam("accountName") String accountName, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("managementPolicyName") String managementPolicyName, + @PathParam("managementPolicyName") ManagementPolicyName managementPolicyName, Context context); } @@ -112,13 +112,15 @@ Mono> delete( * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managementpolicy associated with the specified storage account. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(String resourceGroupName, String accountName) { + public Mono> getWithResponseAsync( + String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -138,7 +140,10 @@ public Mono> getWithResponseAsync(String resourc new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - final String managementPolicyName = "default"; + if (managementPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementPolicyName is required and cannot be null.")); + } return FluxUtil .withContext( context -> @@ -161,6 +166,7 @@ public Mono> getWithResponseAsync(String resourc * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @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. @@ -169,7 +175,7 @@ public Mono> getWithResponseAsync(String resourc */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getWithResponseAsync( - String resourceGroupName, String accountName, Context context) { + String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -189,7 +195,10 @@ public Mono> getWithResponseAsync( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - final String managementPolicyName = "default"; + if (managementPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementPolicyName is required and cannot be null.")); + } return service .get( this.client.getEndpoint(), @@ -208,14 +217,16 @@ public Mono> getWithResponseAsync( * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managementpolicy associated with the specified storage account. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAsync(String resourceGroupName, String accountName) { - return getWithResponseAsync(resourceGroupName, accountName) + public Mono getAsync( + String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName) { + return getWithResponseAsync(resourceGroupName, accountName, managementPolicyName) .flatMap( (Response res) -> { if (res.getValue() != null) { @@ -233,6 +244,7 @@ public Mono getAsync(String resourceGroupName, String acc * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @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. @@ -240,8 +252,9 @@ public Mono getAsync(String resourceGroupName, String acc * @return the managementpolicy associated with the specified storage account. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAsync(String resourceGroupName, String accountName, Context context) { - return getWithResponseAsync(resourceGroupName, accountName, context) + public Mono getAsync( + String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName, Context context) { + return getWithResponseAsync(resourceGroupName, accountName, managementPolicyName, context) .flatMap( (Response res) -> { if (res.getValue() != null) { @@ -259,14 +272,16 @@ public Mono getAsync(String resourceGroupName, String acc * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managementpolicy associated with the specified storage account. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ManagementPolicyInner get(String resourceGroupName, String accountName) { - return getAsync(resourceGroupName, accountName).block(); + public ManagementPolicyInner get( + String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName) { + return getAsync(resourceGroupName, accountName, managementPolicyName).block(); } /** @@ -276,6 +291,7 @@ public ManagementPolicyInner get(String resourceGroupName, String accountName) { * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @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. @@ -283,8 +299,9 @@ public ManagementPolicyInner get(String resourceGroupName, String accountName) { * @return the managementpolicy associated with the specified storage account. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ManagementPolicyInner get(String resourceGroupName, String accountName, Context context) { - return getAsync(resourceGroupName, accountName, context).block(); + public ManagementPolicyInner get( + String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName, Context context) { + return getAsync(resourceGroupName, accountName, managementPolicyName, context).block(); } /** @@ -294,6 +311,7 @@ public ManagementPolicyInner get(String resourceGroupName, String accountName, C * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @param policy The Storage Account ManagementPolicies Rules. See more details in: * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -303,7 +321,10 @@ public ManagementPolicyInner get(String resourceGroupName, String accountName, C */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> createOrUpdateWithResponseAsync( - String resourceGroupName, String accountName, ManagementPolicySchema policy) { + String resourceGroupName, + String accountName, + ManagementPolicyName managementPolicyName, + ManagementPolicySchema policy) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -323,10 +344,13 @@ public Mono> createOrUpdateWithResponseAsync( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } + if (managementPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementPolicyName is required and cannot be null.")); + } if (policy != null) { policy.validate(); } - final String managementPolicyName = "default"; ManagementPolicyInner properties = new ManagementPolicyInner(); properties.withPolicy(policy); return FluxUtil @@ -352,6 +376,7 @@ public Mono> createOrUpdateWithResponseAsync( * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @param policy The Storage Account ManagementPolicies Rules. See more details in: * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. * @param context The context to associate with this operation. @@ -362,7 +387,11 @@ public Mono> createOrUpdateWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> createOrUpdateWithResponseAsync( - String resourceGroupName, String accountName, ManagementPolicySchema policy, Context context) { + String resourceGroupName, + String accountName, + ManagementPolicyName managementPolicyName, + ManagementPolicySchema policy, + Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -382,10 +411,13 @@ public Mono> createOrUpdateWithResponseAsync( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } + if (managementPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementPolicyName is required and cannot be null.")); + } if (policy != null) { policy.validate(); } - final String managementPolicyName = "default"; ManagementPolicyInner properties = new ManagementPolicyInner(); properties.withPolicy(policy); return service @@ -407,6 +439,7 @@ public Mono> createOrUpdateWithResponseAsync( * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @param policy The Storage Account ManagementPolicies Rules. See more details in: * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -416,8 +449,11 @@ public Mono> createOrUpdateWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono createOrUpdateAsync( - String resourceGroupName, String accountName, ManagementPolicySchema policy) { - return createOrUpdateWithResponseAsync(resourceGroupName, accountName, policy) + String resourceGroupName, + String accountName, + ManagementPolicyName managementPolicyName, + ManagementPolicySchema policy) { + return createOrUpdateWithResponseAsync(resourceGroupName, accountName, managementPolicyName, policy) .flatMap( (Response res) -> { if (res.getValue() != null) { @@ -435,6 +471,7 @@ public Mono createOrUpdateAsync( * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @param policy The Storage Account ManagementPolicies Rules. See more details in: * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. * @param context The context to associate with this operation. @@ -445,8 +482,12 @@ public Mono createOrUpdateAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono createOrUpdateAsync( - String resourceGroupName, String accountName, ManagementPolicySchema policy, Context context) { - return createOrUpdateWithResponseAsync(resourceGroupName, accountName, policy, context) + String resourceGroupName, + String accountName, + ManagementPolicyName managementPolicyName, + ManagementPolicySchema policy, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, accountName, managementPolicyName, policy, context) .flatMap( (Response res) -> { if (res.getValue() != null) { @@ -464,6 +505,7 @@ public Mono createOrUpdateAsync( * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @param policy The Storage Account ManagementPolicies Rules. See more details in: * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -473,8 +515,11 @@ public Mono createOrUpdateAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) public ManagementPolicyInner createOrUpdate( - String resourceGroupName, String accountName, ManagementPolicySchema policy) { - return createOrUpdateAsync(resourceGroupName, accountName, policy).block(); + String resourceGroupName, + String accountName, + ManagementPolicyName managementPolicyName, + ManagementPolicySchema policy) { + return createOrUpdateAsync(resourceGroupName, accountName, managementPolicyName, policy).block(); } /** @@ -484,6 +529,7 @@ public ManagementPolicyInner createOrUpdate( * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @param policy The Storage Account ManagementPolicies Rules. See more details in: * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. * @param context The context to associate with this operation. @@ -494,8 +540,12 @@ public ManagementPolicyInner createOrUpdate( */ @ServiceMethod(returns = ReturnType.SINGLE) public ManagementPolicyInner createOrUpdate( - String resourceGroupName, String accountName, ManagementPolicySchema policy, Context context) { - return createOrUpdateAsync(resourceGroupName, accountName, policy, context).block(); + String resourceGroupName, + String accountName, + ManagementPolicyName managementPolicyName, + ManagementPolicySchema policy, + Context context) { + return createOrUpdateAsync(resourceGroupName, accountName, managementPolicyName, policy, context).block(); } /** @@ -505,13 +555,15 @@ public ManagementPolicyInner createOrUpdate( * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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> deleteWithResponseAsync(String resourceGroupName, String accountName) { + public Mono> deleteWithResponseAsync( + String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -531,7 +583,10 @@ public Mono> deleteWithResponseAsync(String resourceGroupName, St new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - final String managementPolicyName = "default"; + if (managementPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementPolicyName is required and cannot be null.")); + } return FluxUtil .withContext( context -> @@ -554,6 +609,7 @@ public Mono> deleteWithResponseAsync(String resourceGroupName, St * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @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. @@ -561,7 +617,8 @@ public Mono> deleteWithResponseAsync(String resourceGroupName, St * @return the completion. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteWithResponseAsync(String resourceGroupName, String accountName, Context context) { + public Mono> deleteWithResponseAsync( + String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -581,7 +638,10 @@ public Mono> deleteWithResponseAsync(String resourceGroupName, St new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - final String managementPolicyName = "default"; + if (managementPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementPolicyName is required and cannot be null.")); + } return service .delete( this.client.getEndpoint(), @@ -600,14 +660,17 @@ public Mono> deleteWithResponseAsync(String resourceGroupName, St * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 deleteAsync(String resourceGroupName, String accountName) { - return deleteWithResponseAsync(resourceGroupName, accountName).flatMap((Response res) -> Mono.empty()); + public Mono deleteAsync( + String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName) { + return deleteWithResponseAsync(resourceGroupName, accountName, managementPolicyName) + .flatMap((Response res) -> Mono.empty()); } /** @@ -617,6 +680,7 @@ public Mono deleteAsync(String resourceGroupName, String accountName) { * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @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. @@ -624,8 +688,9 @@ public Mono deleteAsync(String resourceGroupName, String accountName) { * @return the completion. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteAsync(String resourceGroupName, String accountName, Context context) { - return deleteWithResponseAsync(resourceGroupName, accountName, context) + public Mono deleteAsync( + String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName, Context context) { + return deleteWithResponseAsync(resourceGroupName, accountName, managementPolicyName, context) .flatMap((Response res) -> Mono.empty()); } @@ -636,13 +701,14 @@ public Mono deleteAsync(String resourceGroupName, String accountName, Cont * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 accountName) { - deleteAsync(resourceGroupName, accountName).block(); + public void delete(String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName) { + deleteAsync(resourceGroupName, accountName, managementPolicyName).block(); } /** @@ -652,13 +718,15 @@ public void delete(String resourceGroupName, String accountName) { * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @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 accountName, Context context) { - deleteAsync(resourceGroupName, accountName, context).block(); + public void delete( + String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName, Context context) { + deleteAsync(resourceGroupName, accountName, managementPolicyName, context).block(); } } diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/fluent/inner/StorageAccountInner.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/fluent/inner/StorageAccountInner.java index c423a999ce1f..522af210cef0 100644 --- a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/fluent/inner/StorageAccountInner.java +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/fluent/inner/StorageAccountInner.java @@ -18,6 +18,7 @@ import com.azure.resourcemanager.storage.models.Identity; import com.azure.resourcemanager.storage.models.Kind; import com.azure.resourcemanager.storage.models.LargeFileSharesState; +import com.azure.resourcemanager.storage.models.MinimumTlsVersion; import com.azure.resourcemanager.storage.models.NetworkRuleSet; import com.azure.resourcemanager.storage.models.ProvisioningState; import com.azure.resourcemanager.storage.models.RoutingPreference; @@ -202,6 +203,20 @@ public class StorageAccountInner extends Resource { @JsonProperty(value = "properties.blobRestoreStatus", access = JsonProperty.Access.WRITE_ONLY) private BlobRestoreStatusInner blobRestoreStatus; + /* + * Allow or disallow public access to all blobs or containers in the + * storage account. The default interpretation is true for this property. + */ + @JsonProperty(value = "properties.allowBlobPublicAccess") + private Boolean allowBlobPublicAccess; + + /* + * Set the minimum TLS version to be permitted on requests to storage. The + * default interpretation is TLS 1.0 for this property. + */ + @JsonProperty(value = "properties.minimumTlsVersion") + private MinimumTlsVersion minimumTlsVersion; + /** * Get the sku property: Gets the SKU. * @@ -512,6 +527,50 @@ public BlobRestoreStatusInner blobRestoreStatus() { return this.blobRestoreStatus; } + /** + * Get the allowBlobPublicAccess property: Allow or disallow public access to all blobs or containers in the storage + * account. The default interpretation is true for this property. + * + * @return the allowBlobPublicAccess value. + */ + public Boolean allowBlobPublicAccess() { + return this.allowBlobPublicAccess; + } + + /** + * Set the allowBlobPublicAccess property: Allow or disallow public access to all blobs or containers in the storage + * account. The default interpretation is true for this property. + * + * @param allowBlobPublicAccess the allowBlobPublicAccess value to set. + * @return the StorageAccountInner object itself. + */ + public StorageAccountInner withAllowBlobPublicAccess(Boolean allowBlobPublicAccess) { + this.allowBlobPublicAccess = allowBlobPublicAccess; + return this; + } + + /** + * Get the minimumTlsVersion property: Set the minimum TLS version to be permitted on requests to storage. The + * default interpretation is TLS 1.0 for this property. + * + * @return the minimumTlsVersion value. + */ + public MinimumTlsVersion minimumTlsVersion() { + return this.minimumTlsVersion; + } + + /** + * Set the minimumTlsVersion property: Set the minimum TLS version to be permitted on requests to storage. The + * default interpretation is TLS 1.0 for this property. + * + * @param minimumTlsVersion the minimumTlsVersion value to set. + * @return the StorageAccountInner object itself. + */ + public StorageAccountInner withMinimumTlsVersion(MinimumTlsVersion minimumTlsVersion) { + this.minimumTlsVersion = minimumTlsVersion; + return this; + } + /** * Validates the instance. * diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/implementation/ManagementPoliciesImpl.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/implementation/ManagementPoliciesImpl.java index 2c636cbf010f..aea25d5eaa80 100644 --- a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/implementation/ManagementPoliciesImpl.java +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/implementation/ManagementPoliciesImpl.java @@ -9,6 +9,7 @@ import com.azure.resourcemanager.storage.models.ManagementPolicies; import com.azure.resourcemanager.storage.models.ManagementPolicy; import com.azure.resourcemanager.storage.fluent.inner.ManagementPolicyInner; +import com.azure.resourcemanager.storage.models.ManagementPolicyName; import reactor.core.publisher.Mono; public class ManagementPoliciesImpl extends WrapperImpl implements ManagementPolicies { @@ -38,11 +39,12 @@ private ManagementPolicyImpl wrapModel(String name) { @Override public Mono getAsync(String resourceGroupName, String accountName) { - return this.inner().getAsync(resourceGroupName, accountName).map(inner -> wrapModel(inner)); + return this.inner().getAsync(resourceGroupName, accountName, ManagementPolicyName.DEFAULT) + .map(inner -> wrapModel(inner)); } @Override public Mono deleteAsync(String resourceGroupName, String accountName) { - return this.inner().deleteAsync(resourceGroupName, accountName); + return this.inner().deleteAsync(resourceGroupName, accountName, ManagementPolicyName.DEFAULT); } } diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/implementation/ManagementPolicyImpl.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/implementation/ManagementPolicyImpl.java index bdd45ef996d0..5e7ef0d46900 100644 --- a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/implementation/ManagementPolicyImpl.java +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/implementation/ManagementPolicyImpl.java @@ -10,6 +10,7 @@ import com.azure.resourcemanager.storage.models.BlobTypes; import com.azure.resourcemanager.storage.models.ManagementPolicy; import com.azure.resourcemanager.storage.models.ManagementPolicyBaseBlob; +import com.azure.resourcemanager.storage.models.ManagementPolicyName; import com.azure.resourcemanager.storage.models.ManagementPolicyRule; import com.azure.resourcemanager.storage.models.ManagementPolicySchema; import com.azure.resourcemanager.storage.models.ManagementPolicySnapShot; @@ -62,7 +63,7 @@ public StorageManager manager() { public Mono createResourceAsync() { ManagementPoliciesClient client = this.manager().inner().getManagementPolicies(); return client - .createOrUpdateAsync(this.resourceGroupName, this.accountName, cpolicy) + .createOrUpdateAsync(this.resourceGroupName, this.accountName, ManagementPolicyName.DEFAULT, cpolicy) .map( resource -> { resetCreateUpdateParameters(); @@ -75,7 +76,7 @@ public Mono createResourceAsync() { public Mono updateResourceAsync() { ManagementPoliciesClient client = this.manager().inner().getManagementPolicies(); return client - .createOrUpdateAsync(this.resourceGroupName, this.accountName, upolicy) + .createOrUpdateAsync(this.resourceGroupName, this.accountName, ManagementPolicyName.DEFAULT, upolicy) .map( resource -> { resetCreateUpdateParameters(); @@ -87,7 +88,7 @@ public Mono updateResourceAsync() { @Override protected Mono getInnerAsync() { ManagementPoliciesClient client = this.manager().inner().getManagementPolicies(); - return client.getAsync(this.resourceGroupName, this.accountName); + return client.getAsync(this.resourceGroupName, this.accountName, ManagementPolicyName.DEFAULT); } @Override diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/implementation/PolicyRuleImpl.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/implementation/PolicyRuleImpl.java index 1710a85fa1dc..f0780ec02bcc 100644 --- a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/implementation/PolicyRuleImpl.java +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/implementation/PolicyRuleImpl.java @@ -15,6 +15,8 @@ import com.azure.resourcemanager.storage.models.ManagementPolicyRule; import com.azure.resourcemanager.storage.models.ManagementPolicySnapShot; import com.azure.resourcemanager.storage.models.PolicyRule; +import com.azure.resourcemanager.storage.models.RuleType; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -52,7 +54,7 @@ public String name() { } @Override - public String type() { + public RuleType type() { return this.inner.type(); } @@ -155,7 +157,7 @@ public ManagementPolicyRule inner() { @Override public PolicyRuleImpl withLifecycleRuleType() { - this.inner.withType("Lifecycle"); + this.inner.withType(RuleType.LIFECYCLE); return this; } diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/ListContainersInclude.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/ListContainersInclude.java new file mode 100644 index 000000000000..c2af3fe2e921 --- /dev/null +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/ListContainersInclude.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.storage.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ListContainersInclude. */ +public final class ListContainersInclude extends ExpandableStringEnum { + /** Static value deleted for ListContainersInclude. */ + public static final ListContainersInclude DELETED = fromString("deleted"); + + /** + * Creates or finds a ListContainersInclude from its string representation. + * + * @param name a name to look for. + * @return the corresponding ListContainersInclude. + */ + @JsonCreator + public static ListContainersInclude fromString(String name) { + return fromString(name, ListContainersInclude.class); + } + + /** @return known ListContainersInclude values. */ + public static Collection values() { + return values(ListContainersInclude.class); + } +} diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/ManagementPolicyName.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/ManagementPolicyName.java new file mode 100644 index 000000000000..bb8c037b53ff --- /dev/null +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/ManagementPolicyName.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.storage.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ManagementPolicyName. */ +public final class ManagementPolicyName extends ExpandableStringEnum { + /** Static value default for ManagementPolicyName. */ + public static final ManagementPolicyName DEFAULT = fromString("default"); + + /** + * Creates or finds a ManagementPolicyName from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagementPolicyName. + */ + @JsonCreator + public static ManagementPolicyName fromString(String name) { + return fromString(name, ManagementPolicyName.class); + } + + /** @return known ManagementPolicyName values. */ + public static Collection values() { + return values(ManagementPolicyName.class); + } +} diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/ManagementPolicyRule.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/ManagementPolicyRule.java index 34401ed34446..e53acc39f83f 100644 --- a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/ManagementPolicyRule.java +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/ManagementPolicyRule.java @@ -31,7 +31,7 @@ public final class ManagementPolicyRule { * The valid value is Lifecycle */ @JsonProperty(value = "type", required = true) - private String type; + private RuleType type; /* * An object that defines the Lifecycle rule. @@ -39,11 +39,6 @@ public final class ManagementPolicyRule { @JsonProperty(value = "definition", required = true) private ManagementPolicyDefinition definition; - /** Creates an instance of ManagementPolicyRule class. */ - public ManagementPolicyRule() { - type = "Lifecycle"; - } - /** * Get the enabled property: Rule is enabled if set to true. * @@ -91,7 +86,7 @@ public ManagementPolicyRule withName(String name) { * * @return the type value. */ - public String type() { + public RuleType type() { return this.type; } @@ -101,7 +96,7 @@ public String type() { * @param type the type value to set. * @return the ManagementPolicyRule object itself. */ - public ManagementPolicyRule withType(String type) { + public ManagementPolicyRule withType(RuleType type) { this.type = type; return this; } @@ -137,6 +132,11 @@ public void validate() { .logExceptionAsError( new IllegalArgumentException("Missing required property name in model ManagementPolicyRule")); } + if (type() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property type in model ManagementPolicyRule")); + } if (definition() == null) { throw logger .logExceptionAsError( diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/MinimumTlsVersion.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/MinimumTlsVersion.java new file mode 100644 index 000000000000..4b60198570d2 --- /dev/null +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/MinimumTlsVersion.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.storage.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for MinimumTlsVersion. */ +public final class MinimumTlsVersion extends ExpandableStringEnum { + /** Static value TLS1_0 for MinimumTlsVersion. */ + public static final MinimumTlsVersion TLS1_0 = fromString("TLS1_0"); + + /** Static value TLS1_1 for MinimumTlsVersion. */ + public static final MinimumTlsVersion TLS1_1 = fromString("TLS1_1"); + + /** Static value TLS1_2 for MinimumTlsVersion. */ + public static final MinimumTlsVersion TLS1_2 = fromString("TLS1_2"); + + /** + * Creates or finds a MinimumTlsVersion from its string representation. + * + * @param name a name to look for. + * @return the corresponding MinimumTlsVersion. + */ + @JsonCreator + public static MinimumTlsVersion fromString(String name) { + return fromString(name, MinimumTlsVersion.class); + } + + /** @return known MinimumTlsVersion values. */ + public static Collection values() { + return values(MinimumTlsVersion.class); + } +} diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/PolicyRule.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/PolicyRule.java index 8940c411f46e..6226d6ca18a6 100644 --- a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/PolicyRule.java +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/PolicyRule.java @@ -16,7 +16,7 @@ public interface PolicyRule extends HasInner { String name(); /** @return the type of the rule */ - String type(); + RuleType type(); /** @return an unmodifiable list of the blob types this rule will apply for */ List blobTypesToFilterFor(); diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/RuleType.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/RuleType.java new file mode 100644 index 000000000000..18de5872c543 --- /dev/null +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/RuleType.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.storage.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RuleType. */ +public final class RuleType extends ExpandableStringEnum { + /** Static value Lifecycle for RuleType. */ + public static final RuleType LIFECYCLE = fromString("Lifecycle"); + + /** + * Creates or finds a RuleType from its string representation. + * + * @param name a name to look for. + * @return the corresponding RuleType. + */ + @JsonCreator + public static RuleType fromString(String name) { + return fromString(name, RuleType.class); + } + + /** @return known RuleType values. */ + public static Collection values() { + return values(RuleType.class); + } +} diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/StorageAccountCreateParameters.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/StorageAccountCreateParameters.java index 4824320bb83a..67c6343dcb7e 100644 --- a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/StorageAccountCreateParameters.java +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/StorageAccountCreateParameters.java @@ -117,6 +117,20 @@ public class StorageAccountCreateParameters { @JsonProperty(value = "properties.routingPreference") private RoutingPreference routingPreference; + /* + * Allow or disallow public access to all blobs or containers in the + * storage account. The default interpretation is true for this property. + */ + @JsonProperty(value = "properties.allowBlobPublicAccess") + private Boolean allowBlobPublicAccess; + + /* + * Set the minimum TLS version to be permitted on requests to storage. The + * default interpretation is TLS 1.0 for this property. + */ + @JsonProperty(value = "properties.minimumTlsVersion") + private MinimumTlsVersion minimumTlsVersion; + /** * Get the sku property: Required. Gets or sets the SKU name. * @@ -426,6 +440,50 @@ public StorageAccountCreateParameters withRoutingPreference(RoutingPreference ro return this; } + /** + * Get the allowBlobPublicAccess property: Allow or disallow public access to all blobs or containers in the storage + * account. The default interpretation is true for this property. + * + * @return the allowBlobPublicAccess value. + */ + public Boolean allowBlobPublicAccess() { + return this.allowBlobPublicAccess; + } + + /** + * Set the allowBlobPublicAccess property: Allow or disallow public access to all blobs or containers in the storage + * account. The default interpretation is true for this property. + * + * @param allowBlobPublicAccess the allowBlobPublicAccess value to set. + * @return the StorageAccountCreateParameters object itself. + */ + public StorageAccountCreateParameters withAllowBlobPublicAccess(Boolean allowBlobPublicAccess) { + this.allowBlobPublicAccess = allowBlobPublicAccess; + return this; + } + + /** + * Get the minimumTlsVersion property: Set the minimum TLS version to be permitted on requests to storage. The + * default interpretation is TLS 1.0 for this property. + * + * @return the minimumTlsVersion value. + */ + public MinimumTlsVersion minimumTlsVersion() { + return this.minimumTlsVersion; + } + + /** + * Set the minimumTlsVersion property: Set the minimum TLS version to be permitted on requests to storage. The + * default interpretation is TLS 1.0 for this property. + * + * @param minimumTlsVersion the minimumTlsVersion value to set. + * @return the StorageAccountCreateParameters object itself. + */ + public StorageAccountCreateParameters withMinimumTlsVersion(MinimumTlsVersion minimumTlsVersion) { + this.minimumTlsVersion = minimumTlsVersion; + return this; + } + /** * Validates the instance. * diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/StorageAccountUpdateParameters.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/StorageAccountUpdateParameters.java index 3a06f67a24a2..9c16308ea991 100644 --- a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/StorageAccountUpdateParameters.java +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/StorageAccountUpdateParameters.java @@ -103,6 +103,20 @@ public class StorageAccountUpdateParameters { @JsonProperty(value = "properties.routingPreference") private RoutingPreference routingPreference; + /* + * Allow or disallow public access to all blobs or containers in the + * storage account. The default interpretation is true for this property. + */ + @JsonProperty(value = "properties.allowBlobPublicAccess") + private Boolean allowBlobPublicAccess; + + /* + * Set the minimum TLS version to be permitted on requests to storage. The + * default interpretation is TLS 1.0 for this property. + */ + @JsonProperty(value = "properties.minimumTlsVersion") + private MinimumTlsVersion minimumTlsVersion; + /** * Get the sku property: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, * Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any other value. @@ -366,6 +380,50 @@ public StorageAccountUpdateParameters withRoutingPreference(RoutingPreference ro return this; } + /** + * Get the allowBlobPublicAccess property: Allow or disallow public access to all blobs or containers in the storage + * account. The default interpretation is true for this property. + * + * @return the allowBlobPublicAccess value. + */ + public Boolean allowBlobPublicAccess() { + return this.allowBlobPublicAccess; + } + + /** + * Set the allowBlobPublicAccess property: Allow or disallow public access to all blobs or containers in the storage + * account. The default interpretation is true for this property. + * + * @param allowBlobPublicAccess the allowBlobPublicAccess value to set. + * @return the StorageAccountUpdateParameters object itself. + */ + public StorageAccountUpdateParameters withAllowBlobPublicAccess(Boolean allowBlobPublicAccess) { + this.allowBlobPublicAccess = allowBlobPublicAccess; + return this; + } + + /** + * Get the minimumTlsVersion property: Set the minimum TLS version to be permitted on requests to storage. The + * default interpretation is TLS 1.0 for this property. + * + * @return the minimumTlsVersion value. + */ + public MinimumTlsVersion minimumTlsVersion() { + return this.minimumTlsVersion; + } + + /** + * Set the minimumTlsVersion property: Set the minimum TLS version to be permitted on requests to storage. The + * default interpretation is TLS 1.0 for this property. + * + * @param minimumTlsVersion the minimumTlsVersion value to set. + * @return the StorageAccountUpdateParameters object itself. + */ + public StorageAccountUpdateParameters withMinimumTlsVersion(MinimumTlsVersion minimumTlsVersion) { + this.minimumTlsVersion = minimumTlsVersion; + return this; + } + /** * Validates the instance. * diff --git a/sdk/storage/test-resources.json b/sdk/storage/test-resources.json index a977635c1f55..d60bc654fa19 100644 --- a/sdk/storage/test-resources.json +++ b/sdk/storage/test-resources.json @@ -17,7 +17,7 @@ } }, "variables": { - "storageApiVersion": "2019-04-01", + "storageApiVersion": "2019-06-01", "authorizationApiVersion": "2018-09-01-preview", "blobDataContributorRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/ba92f5b4-2d11-453d-a403-e96b0029c9fe')]", "contributorRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c')]", @@ -85,6 +85,36 @@ "accessTier": "Hot" } }, + { + "type": "Microsoft.Storage/storageAccounts/blobServices", + "apiVersion": "[variables('storageApiVersion')]", + "name": "[concat(variables('primaryAccountName'), '/default')]", + "properties": { + "isVersioningEnabled": true, + "deleteRetentionPolicy": { + "enabled": true, + "days": 1 + } + + }, + "dependsOn": [ + "[variables('primaryAccountName')]" + ] + }, + { + "type": "Microsoft.Storage/storageAccounts/fileServices", + "apiVersion": "[variables('storageApiVersion')]", + "name": "[concat(variables('primaryAccountName'), '/default')]", + "properties": { + "shareDeleteRetentionPolicy": { + "enabled": true, + "days": 1 + } + }, + "dependsOn": [ + "[variables('primaryAccountName')]" + ] + }, { "type": "Microsoft.Storage/storageAccounts", "apiVersion": "[variables('storageApiVersion')]", diff --git a/sdk/storage/tests.yml b/sdk/storage/tests.yml index 681abbf13d5b..a8bd8cec347f 100644 --- a/sdk/storage/tests.yml +++ b/sdk/storage/tests.yml @@ -14,6 +14,9 @@ jobs: - name: azure-storage-blob-batch groupId: com.azure safeName: azurestorageblobbatch + - name: azure-storage-blob-changefeed + groupId: com.azure + safeName: azurestorageblobchangefeed - name: azure-storage-blob-cryptography groupId: com.azure safeName: azurestorageblobcryptography @@ -26,10 +29,15 @@ jobs: - name: azure-storage-file-datalake groupId: com.azure safeName: azurestoragefiledatalake + - name: azure-storage-internal-avro + groupId: com.azure + safeName: azurestorageinternalavro - name: azure-storage-queue groupId: com.azure safeName: azurestoragequeue TimeoutInMinutes: 120 + Location: canadacentral + SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources-preview) EnvVars: AZURE_TEST_MODE: LIVE AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id) @@ -37,3 +45,4 @@ jobs: AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret) VERSIONED_STORAGE_ACCOUNT_NAME: $(java-storage-versioned-account-name) VERSIONED_STORAGE_ACCOUNT_KEY: $(java-storage-versioned-account-key) + diff --git a/sdk/tables/azure-data-tables/CHANGELOG.md b/sdk/tables/azure-data-tables/CHANGELOG.md new file mode 100644 index 000000000000..4144f75694a0 --- /dev/null +++ b/sdk/tables/azure-data-tables/CHANGELOG.md @@ -0,0 +1,3 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) diff --git a/sdk/tables/azure-data-tables/pom.xml b/sdk/tables/azure-data-tables/pom.xml index 4fb23afccc72..4ca605848391 100644 --- a/sdk/tables/azure-data-tables/pom.xml +++ b/sdk/tables/azure-data-tables/pom.xml @@ -2,7 +2,8 @@ Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. --> - + 4.0.0 com.azure @@ -31,7 +32,6 @@ Licensed under the MIT License. HEAD - true @@ -40,7 +40,30 @@ Licensed under the MIT License. com.azure azure-core - 1.6.0 + 1.7.0-beta.1 + + + com.azure + azure-storage-common + 12.8.0-beta.1 + + + org.junit.jupiter + junit-jupiter + 5.6.2 + test + + + io.projectreactor + reactor-test + 3.3.5.RELEASE + test + + + com.azure + azure-core-test + 1.3.1 + test diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TablesSharedKeyCredential.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TablesSharedKeyCredential.java new file mode 100644 index 000000000000..276be119ad64 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TablesSharedKeyCredential.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.data.tables; + +import com.azure.storage.common.implementation.StorageImplUtils; + +import java.net.URL; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; + +/** + * A Class which helps generate the shared key credentials for a given storage account to create a Http requests to + * access Azure Tables + */ +public class TablesSharedKeyCredential { + private static final String AUTHORIZATION_HEADER_FORMAT = "SharedKeyLite %s:%s"; + private final String accountName; + private final String accountKey; + + /** + * Constructor for TableSharedKeyCredential Class + * + * @param accountName name of the storage account + * @param accountKey key to the storage account + */ + public TablesSharedKeyCredential(String accountName, String accountKey) { + this.accountName = Objects.requireNonNull(accountName, "'accountName' cannot be null."); + this.accountKey = Objects.requireNonNull(accountKey, "'accountKey' cannot be null."); + } + + /** + * Generates the Auth Headers + * + * @param requestUrl the URL which the request is going to + * @param headers the headers of the request + * @return the auth header + */ + public String generateAuthorizationHeader(URL requestUrl, Map headers) { + String signature = StorageImplUtils.computeHMac256(accountKey, buildStringToSign(requestUrl, + headers)); + return String.format(AUTHORIZATION_HEADER_FORMAT, accountName, signature); + } + + /** + * creates the String to Sign + * + * @param requestUrl the Url which the request is going to + * @param headers the headers of the request + * @return a string to sign for the request + */ + private String buildStringToSign(URL requestUrl, Map headers) { + String dateHeader = headers.containsKey("x-ms-date") + ? "" + : this.getStandardHeaderValue(headers, "Date"); + return String.join("\n", + dateHeader, //date + getCanonicalizedResource(requestUrl)); //Canonicalized resource + } + + /** + * gets necessary headers if the request does not already contain them + * + * @param headers a map of the headers which the request has + * @param headerName the name of the header to get the standard header for + * @return the standard header for the given name + */ + private String getStandardHeaderValue(Map headers, String headerName) { + String headerValue = headers.get(headerName); + return headerValue == null ? "" : headerValue; + } + + + /** + * returns the canonicalized resource needed for a request + * + * @param requestUrl the url of the request + * @return the string that is the canonicalized resource + */ + private String getCanonicalizedResource(URL requestUrl) { + StringBuilder canonicalizedResource = new StringBuilder("/").append(accountName); + if (requestUrl.getPath().length() > 0) { + canonicalizedResource.append(requestUrl.getPath()); + } else { + canonicalizedResource.append('/'); + } + + if (requestUrl.getQuery() != null) { + Map queryParams = StorageImplUtils.parseQueryStringSplitValues(requestUrl.getQuery()); + ArrayList queryParamNames = new ArrayList<>(queryParams.keySet()); + + Collections.sort(queryParamNames); + + for (String queryParamName : queryParamNames) { + String[] queryParamValues = queryParams.get(queryParamName); + + Arrays.sort(queryParamValues); + + String queryParamValuesStr = String.join(",", queryParamValues); + + if (queryParamName.equalsIgnoreCase("comp")) { + canonicalizedResource.append("?").append(queryParamName.toLowerCase(Locale.ROOT)).append("=") + .append(queryParamValuesStr); + } + } + } + return canonicalizedResource.toString(); + } +} diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TablesSharedKeyCredentialPolicy.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TablesSharedKeyCredentialPolicy.java new file mode 100644 index 000000000000..f689b85d043a --- /dev/null +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TablesSharedKeyCredentialPolicy.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.data.tables; + +import com.azure.core.http.HttpPipelineCallContext; +import com.azure.core.http.HttpPipelineNextPolicy; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.policy.HttpPipelinePolicy; +import reactor.core.publisher.Mono; + +/** + * This class helps authenticate an Http request for the Tables service + */ +public final class TablesSharedKeyCredentialPolicy implements HttpPipelinePolicy { + + private final TablesSharedKeyCredential credential; + + /** + * constructor for the TablesSharedKeyCredentialPolicy class + * + * @param credential the credentials of the account + */ + public TablesSharedKeyCredentialPolicy(TablesSharedKeyCredential credential) { + this.credential = credential; + } + + /** + * creates an Http response + * + * @param context the context of the http pipeline + * @param next the next Http pipeline policy + * @return an Http response + */ + public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { + String authorizationValue = credential.generateAuthorizationHeader(context.getHttpRequest().getUrl(), + context.getHttpRequest().getHeaders().toMap()); + context.getHttpRequest().setHeader("Authorization", authorizationValue); + return next.process(); + } +} diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/package-info.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/package-info.java new file mode 100644 index 000000000000..22fcc4bc3349 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/package-info.java @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +/** Package containing the inner classes for Azure Tables SDK. */ +package com.azure.data.tables; diff --git a/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/AzureTableImplTest.java b/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/AzureTableImplTest.java new file mode 100644 index 000000000000..24f613383869 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/AzureTableImplTest.java @@ -0,0 +1,527 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.data.tables; + +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.test.TestBase; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.data.tables.implementation.AzureTableImpl; +import com.azure.data.tables.implementation.AzureTableImplBuilder; +import com.azure.data.tables.implementation.models.OdataMetadataFormat; +import com.azure.data.tables.implementation.models.QueryOptions; +import com.azure.data.tables.implementation.models.ResponseFormat; +import com.azure.data.tables.implementation.models.TableProperties; +import com.azure.data.tables.implementation.models.TableResponseProperties; +import com.azure.data.tables.implementation.models.TableServiceErrorException; +import com.azure.storage.common.implementation.connectionstring.StorageAuthenticationSettings; +import com.azure.storage.common.implementation.connectionstring.StorageConnectionString; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +/** + * This class tests the Autorest code for the Tables track 2 SDK + */ +public class AzureTableImplTest extends TestBase { + private static final String PARTITION_KEY = "PartitionKey"; + private static final String ROW_KEY = "RowKey"; + private static final int TIMEOUT = 5000; + private AzureTableImpl azureTable; + + @Override + protected void beforeTest() { + String connectionString = interceptorManager.isPlaybackMode() + ? "DefaultEndpointsProtocol=https;AccountName=dummyAccount;AccountKey=xyzDummy;EndpointSuffix=core.windows.net" + : System.getenv("AZURE_TABLES_CONNECTION_STRING"); + StorageConnectionString storageConnectionString + = StorageConnectionString.create(connectionString, new ClientLogger(AzureTableImplTest.class)); + + Assertions.assertNotNull(connectionString, "Cannot continue test if connectionString is not set."); + + StorageAuthenticationSettings authSettings = storageConnectionString.getStorageAuthSettings(); + TablesSharedKeyCredential sharedKeyCredential = new TablesSharedKeyCredential(authSettings.getAccount().getName(), + authSettings.getAccount().getAccessKey()); + + List policies = new ArrayList<>(); + policies.add(new AddDatePolicy()); + policies.add(new AddHeadersPolicy(new HttpHeaders().put("Accept", + OdataMetadataFormat.APPLICATION_JSON_ODATA_MINIMALMETADATA.toString()))); + policies.add(new TablesSharedKeyCredentialPolicy(sharedKeyCredential)); + policies.add(new HttpLoggingPolicy(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS))); + + HttpClient httpClientToUse; + if (interceptorManager.isPlaybackMode()) { + httpClientToUse = interceptorManager.getPlaybackClient(); + } else { + httpClientToUse = HttpClient.createDefault(); + policies.add(interceptorManager.getRecordPolicy()); + policies.add(new RetryPolicy()); + } + HttpPipeline pipeline = new HttpPipelineBuilder() + .httpClient(httpClientToUse) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + azureTable = new AzureTableImplBuilder() + .pipeline(pipeline) + .version("2019-02-02") + .url(storageConnectionString.getTableEndpoint().getPrimaryUri()) + .buildClient(); + } + + @Override + protected void afterTest() { + QueryOptions queryOptions = new QueryOptions() + .setFormat(OdataMetadataFormat.APPLICATION_JSON_ODATA_MINIMALMETADATA); + + Mono.when(azureTable.getTables().queryWithResponseAsync(testResourceNamer.randomUuid(), null, + queryOptions, Context.NONE).flatMapMany(tablesQueryResponse -> { + return Flux.fromIterable(tablesQueryResponse.getValue().getValue()).flatMap(tableResponseProperty -> { + return azureTable.getTables().deleteWithResponseAsync(tableResponseProperty.getTableName(), + testResourceNamer.randomUuid(), Context.NONE); + }); + })).block(); + } + + void createTable(String tableName) { + TableProperties tableProperties = new TableProperties().setTableName(tableName); + String requestId = testResourceNamer.randomUuid(); + + azureTable.getTables().createWithResponseAsync(tableProperties, requestId, + ResponseFormat.RETURN_CONTENT, null, Context.NONE).block(); + } + + void insertNoETag(String tableName, Map properties) { + String requestId = testResourceNamer.randomUuid(); + + azureTable.getTables().insertEntityWithResponseAsync(tableName, TIMEOUT, + requestId, ResponseFormat.RETURN_CONTENT, properties, null, Context.NONE).log().block(); + } + + @Test + void createTable() { + // Arrange + String tableName = testResourceNamer.randomName("test", 20); + TableProperties tableProperties = new TableProperties().setTableName(tableName); + int expectedStatusCode = 201; + String requestId = testResourceNamer.randomUuid(); + + // Act & Assert + StepVerifier.create(azureTable.getTables().createWithResponseAsync(tableProperties, + requestId, ResponseFormat.RETURN_CONTENT, null, Context.NONE)) + .assertNext(response -> { + Assertions.assertEquals(expectedStatusCode, response.getStatusCode()); + }) + .expectComplete() + .verify(); + } + + @Test + void createTableDuplicateName() { + // Arrange + String tableName = testResourceNamer.randomName("test", 20); + TableProperties tableProperties = new TableProperties().setTableName(tableName); + createTable(tableName); + String requestId = testResourceNamer.randomUuid(); + + // Act & Assert + StepVerifier.create(azureTable.getTables().createWithResponseAsync(tableProperties, + requestId, ResponseFormat.RETURN_CONTENT, null, Context.NONE)) + .expectError(TableServiceErrorException.class) + .verify(); + } + + @Test + void deleteTable() { + // Arrange + String tableName = testResourceNamer.randomName("test", 20); + createTable(tableName); + int expectedStatusCode = 204; + String requestId = testResourceNamer.randomUuid(); + + // Act & Assert + StepVerifier.create(azureTable.getTables().deleteWithResponseAsync(tableName, requestId, + Context.NONE)) + .assertNext(response -> { + Assertions.assertEquals(expectedStatusCode, response.getStatusCode()); + }) + .expectComplete() + .verify(); + } + + @Test + void deleteNonExistentTable() { + // Arrange + String tableName = testResourceNamer.randomName("test", 20); + String requestId = testResourceNamer.randomUuid(); + + // Act & Assert + StepVerifier.create(azureTable.getTables().deleteWithResponseAsync(tableName, requestId, + Context.NONE)) + .expectError(com.azure.data.tables.implementation.models.TableServiceErrorException.class) + .verify(); + } + + @Test + void queryTable() { + // Arrange + QueryOptions queryOptions = new QueryOptions() + .setFormat(OdataMetadataFormat.APPLICATION_JSON_ODATA_MINIMALMETADATA); + String tableA = testResourceNamer.randomName("AtestA", 20); + String tableB = testResourceNamer.randomName("BtestB", 20); + createTable(tableA); + createTable(tableB); + int expectedStatusCode = 200; + String requestId = testResourceNamer.randomUuid(); + + // Act & Assert + StepVerifier.create(azureTable.getTables().queryWithResponseAsync(requestId, null, + queryOptions, Context.NONE)) + .assertNext(response -> { + Assertions.assertEquals(expectedStatusCode, response.getStatusCode()); + Assertions.assertNotNull(response.getValue(), "Expected there to be a result."); + + List results = response.getValue().getValue(); + + Assertions.assertNotNull(results, "Expected there to be a set of items."); + Assertions.assertEquals(2, results.size()); + Assertions.assertEquals(response.getValue().getValue().get(0).getTableName(), tableA); + Assertions.assertEquals(response.getValue().getValue().get(1).getTableName(), tableB); + }) + .expectComplete() + .verify(); + } + + @Test + void queryTablewithTop() { + // Arrange + QueryOptions queryOptions = new QueryOptions() + .setFormat(OdataMetadataFormat.APPLICATION_JSON_ODATA_MINIMALMETADATA); + String tableA = testResourceNamer.randomName("AtestA", 20); + String tableB = testResourceNamer.randomName("BtestB", 20); + createTable(tableA); + createTable(tableB); + int expectedStatusCode = 200; + int expectedSize = 1; + String requestId = testResourceNamer.randomUuid(); + queryOptions.setTop(1); + + // Act & Assert + StepVerifier.create(azureTable.getTables().queryWithResponseAsync(requestId, null, + queryOptions, Context.NONE)) + .assertNext(response -> { + Assertions.assertEquals(expectedStatusCode, response.getStatusCode()); + Assertions.assertEquals(expectedSize, response.getValue().getValue().size()); + Assertions.assertEquals(tableA, response.getValue().getValue().get(0).getTableName()); + }) + .expectComplete() + .verify(); + } + + @Test + void insertNoEtag() { + // Arrange + String tableName = testResourceNamer.randomName("test", 20); + createTable(tableName); + Map properties = new HashMap<>(); + String partitionKeyValue = testResourceNamer.randomName("partitionKey", 20); + String rowKeyValue = testResourceNamer.randomName("rowKey", 20); + properties.put(PARTITION_KEY, partitionKeyValue); + properties.put(ROW_KEY, rowKeyValue); + int expectedStatusCode = 201; + String requestId = testResourceNamer.randomUuid(); + + // Act & Assert + StepVerifier.create(azureTable.getTables().insertEntityWithResponseAsync(tableName, TIMEOUT, + requestId, ResponseFormat.RETURN_CONTENT, properties, null, Context.NONE)) + .assertNext(response -> { + Assertions.assertEquals(expectedStatusCode, response.getStatusCode()); + }) + .expectComplete() + .verify(); + } + + @Test + void mergeEntity() { + // Arrange + String tableName = testResourceNamer.randomName("test", 20); + createTable(tableName); + Map properties = new HashMap<>(); + String partitionKeyValue = testResourceNamer.randomName("partitionKey", 20); + String rowKeyValue = testResourceNamer.randomName("rowKey", 20); + properties.put(PARTITION_KEY, partitionKeyValue); + properties.put(ROW_KEY, rowKeyValue); + int expectedStatusCode = 204; + String requestId = testResourceNamer.randomUuid(); + insertNoETag(tableName, properties); + properties.put("extraProperty", testResourceNamer.randomName("extraProperty", 16)); + + // Act & Assert + StepVerifier.create(azureTable.getTables().mergeEntityWithResponseAsync(tableName, partitionKeyValue, + rowKeyValue, TIMEOUT, requestId, "*", properties, null, Context.NONE)) + .assertNext(response -> { + Assertions.assertEquals(expectedStatusCode, response.getStatusCode()); + }) + .expectComplete() + .verify(); + } + + @Test + void mergeNonExistentEntity() { + // Arrange + String tableName = testResourceNamer.randomName("test", 20); + createTable(tableName); + Map properties = new HashMap<>(); + String partitionKeyValue = testResourceNamer.randomName("partitionKey", 20); + String rowKeyValue = testResourceNamer.randomName("rowKey", 20); + String requestId = testResourceNamer.randomUuid(); + + // Act & Assert + StepVerifier.create(azureTable.getTables().mergeEntityWithResponseAsync(tableName, partitionKeyValue, + rowKeyValue, TIMEOUT, requestId, "*", properties, null, Context.NONE)) + .expectError(com.azure.data.tables.implementation.models.TableServiceErrorException.class) + .verify(); + } + + @Test + void updateEntity() { + // Arrange + String tableName = testResourceNamer.randomName("test", 20); + createTable(tableName); + Map properties = new HashMap<>(); + String partitionKeyValue = testResourceNamer.randomName("partitionKey", 20); + String rowKeyValue = testResourceNamer.randomName("rowKey", 20); + properties.put(PARTITION_KEY, partitionKeyValue); + properties.put(ROW_KEY, rowKeyValue); + int expectedStatusCode = 204; + String requestId = testResourceNamer.randomUuid(); + insertNoETag(tableName, properties); + properties.put("extraProperty", testResourceNamer.randomName("extraProperty", 16)); + + // Act & Assert + StepVerifier.create(azureTable.getTables().updateEntityWithResponseAsync(tableName, partitionKeyValue, + rowKeyValue, TIMEOUT, requestId, "*", properties, null, Context.NONE)) + .assertNext(response -> { + Assertions.assertEquals(expectedStatusCode, response.getStatusCode()); + }) + .expectComplete() + .verify(); + } + + @Test + void updateNonExistentEntity() { + // Arrange + String tableName = testResourceNamer.randomName("test", 20); + createTable(tableName); + Map properties = new HashMap<>(); + String partitionKeyValue = testResourceNamer.randomName("partitionKey", 20); + String rowKeyValue = testResourceNamer.randomName("rowKey", 20); + String requestId = testResourceNamer.randomUuid(); + + // Act & Assert + StepVerifier.create(azureTable.getTables().updateEntityWithResponseAsync(tableName, partitionKeyValue, + rowKeyValue, TIMEOUT, requestId, "*", properties, null, Context.NONE)) + .expectError(com.azure.data.tables.implementation.models.TableServiceErrorException.class) + .verify(); + } + + @Test + void deleteEntity() { + // Arrange + String tableName = testResourceNamer.randomName("test", 20); + createTable(tableName); + Map properties = new HashMap<>(); + String partitionKeyValue = testResourceNamer.randomName("partitionKey", 20); + String rowKeyValue = testResourceNamer.randomName("rowKey", 20); + properties.put(PARTITION_KEY, partitionKeyValue); + properties.put(ROW_KEY, rowKeyValue); + int expectedStatusCode = 204; + String requestId = testResourceNamer.randomUuid(); + insertNoETag(tableName, properties); + + // Act & Assert + StepVerifier.create(azureTable.getTables().deleteEntityWithResponseAsync(tableName, partitionKeyValue, + rowKeyValue, "*", TIMEOUT, requestId, null, Context.NONE)) + .assertNext(response -> { + Assertions.assertEquals(expectedStatusCode, response.getStatusCode()); + }) + .expectComplete() + .verify(); + } + + @Test + void deleteNonExistentEntity() { + // Arrange + String tableName = testResourceNamer.randomName("test", 20); + createTable(tableName); + String partitionKeyValue = testResourceNamer.randomName("partitionKey", 20); + String rowKeyValue = testResourceNamer.randomName("rowKey", 20); + String requestId = testResourceNamer.randomUuid(); + + // Act & Assert + StepVerifier.create(azureTable.getTables().deleteEntityWithResponseAsync(tableName, partitionKeyValue, + rowKeyValue, "*", TIMEOUT, requestId, null, Context.NONE)) + .expectError(com.azure.data.tables.implementation.models.TableServiceErrorException.class) + .verify(); + } + + @Test + void queryEntity() { + // Arrange + String requestId = testResourceNamer.randomUuid(); + QueryOptions queryOptions = new QueryOptions().setFormat(OdataMetadataFormat.APPLICATION_JSON_ODATA_FULLMETADATA); + String tableName = testResourceNamer.randomName("test", 20); + createTable(tableName); + //insert entity A + Map entityA = new HashMap<>(); + String partitionKeyEntityA = testResourceNamer.randomName("partitionKeyA", 20); + entityA.put(PARTITION_KEY, partitionKeyEntityA); + entityA.put(ROW_KEY, testResourceNamer.randomName("rowKeyA", 20)); + insertNoETag(tableName, entityA); + //insert entity B + Map entityB = new HashMap<>(); + String partitionKeyEntityB = testResourceNamer.randomName("partitionKeyB", 20); + entityB.put(PARTITION_KEY, partitionKeyEntityB); + entityB.put(ROW_KEY, testResourceNamer.randomName("rowKeyB", 20)); + insertNoETag(tableName, entityB); + int expectedStatusCode = 200; + + // Act & Assert + StepVerifier.create(azureTable.getTables().queryEntitiesWithResponseAsync(tableName, TIMEOUT, + requestId, null, null, queryOptions, Context.NONE)) + .assertNext(response -> { + Assertions.assertEquals(expectedStatusCode, response.getStatusCode()); + Assertions.assertEquals(true, response.getValue().getValue().get(0).containsValue(partitionKeyEntityA)); + Assertions.assertEquals(true, response.getValue().getValue().get(1).containsValue(partitionKeyEntityB)); + + }) + .expectComplete() + .verify(); + } + + @Test + void queryEntityWithSelect() { + // Arrange + String requestId = testResourceNamer.randomUuid(); + QueryOptions queryOptions = new QueryOptions().setFormat(OdataMetadataFormat.APPLICATION_JSON_ODATA_FULLMETADATA); + String tableName = testResourceNamer.randomName("test", 20); + createTable(tableName); + //insert entity A + Map entityA = new HashMap<>(); + String partitionKeyEntityA = testResourceNamer.randomName("partitionKeyA", 20); + String rowKeyEntityA = testResourceNamer.randomName("rowKeyA", 20); + entityA.put(PARTITION_KEY, partitionKeyEntityA); + entityA.put(ROW_KEY, rowKeyEntityA); + insertNoETag(tableName, entityA); + //insert entity B + Map entityB = new HashMap<>(); + String partitionKeyEntityB = testResourceNamer.randomName("partitionKeyB", 20); + String rowKeyEntityB = testResourceNamer.randomName("rowKeyB", 20); + entityB.put(PARTITION_KEY, partitionKeyEntityB); + entityB.put(ROW_KEY, rowKeyEntityB); + insertNoETag(tableName, entityB); + int expectedStatusCode = 200; + queryOptions.setSelect(ROW_KEY); + + // Act & Assert + StepVerifier.create(azureTable.getTables().queryEntitiesWithResponseAsync(tableName, TIMEOUT, + requestId, null, null, queryOptions, Context.NONE)) + .assertNext(response -> { + Assertions.assertEquals(expectedStatusCode, response.getStatusCode()); + Assertions.assertEquals(true, response.getValue().getValue().get(0).containsValue(rowKeyEntityA)); + Assertions.assertEquals(true, response.getValue().getValue().get(1).containsValue(rowKeyEntityB)); + + }) + .expectComplete() + .verify(); + } + + @Test + void queryEntityWithFilter() { + // Arrange + String requestId = testResourceNamer.randomUuid(); + QueryOptions queryOptions = new QueryOptions().setFormat(OdataMetadataFormat.APPLICATION_JSON_ODATA_FULLMETADATA); + String tableName = testResourceNamer.randomName("test", 20); + createTable(tableName); + Map entityA = new HashMap<>(); + String partitionKeyEntityA = testResourceNamer.randomName("partitionKeyA", 20); + entityA.put(PARTITION_KEY, partitionKeyEntityA); + entityA.put(ROW_KEY, testResourceNamer.randomName("rowKeyA", 20)); + insertNoETag(tableName, entityA); + int expectedStatusCode = 200; + queryOptions.setSelect(PARTITION_KEY + "eq" + partitionKeyEntityA); + + // Act & Assert + StepVerifier.create(azureTable.getTables().queryEntitiesWithResponseAsync(tableName, TIMEOUT, + requestId, null, null, queryOptions, Context.NONE)) + .assertNext(response -> { + Assertions.assertEquals(expectedStatusCode, response.getStatusCode()); + + }) + .expectComplete() + .verify(); + } + + @Test + void queryEntityWithTop() { + // Arrange + String requestId = testResourceNamer.randomUuid(); + QueryOptions queryOptions = new QueryOptions().setFormat(OdataMetadataFormat.APPLICATION_JSON_ODATA_FULLMETADATA); + String tableName = testResourceNamer.randomName("test", 20); + createTable(tableName); + int expectedStatusCode = 200; + queryOptions.setTop(0); + + // Act & Assert + StepVerifier.create(azureTable.getTables().queryEntitiesWithResponseAsync(tableName, TIMEOUT, + requestId, null, null, queryOptions, Context.NONE)) + .assertNext(response -> { + Assertions.assertEquals(expectedStatusCode, response.getStatusCode()); + + }) + .expectComplete() + .verify(); + } + + + @Test + void queryEntitiesWithPartitionAndRowKey() { + // Arrange + QueryOptions queryOptions = new QueryOptions().setFormat(OdataMetadataFormat.APPLICATION_JSON_ODATA_FULLMETADATA); + String tableName = testResourceNamer.randomName("test", 20); + createTable(tableName); + Map properties = new HashMap<>(); + String partitionKeyValue = testResourceNamer.randomName("partitionKey", 20); + String rowKeyValue = testResourceNamer.randomName("rowKey", 20); + properties.put(PARTITION_KEY, partitionKeyValue); + properties.put(ROW_KEY, rowKeyValue); + insertNoETag(tableName, properties); + + // Act & Assert + StepVerifier.create(azureTable.getTables().queryEntitiesWithPartitionAndRowKeyWithResponseAsync(tableName, partitionKeyValue, + rowKeyValue, TIMEOUT, testResourceNamer.randomUuid(), queryOptions, Context.NONE)) + .assertNext(response -> { + Assertions.assertEquals(200, response.getStatusCode()); + }) + .expectComplete() + .verify(); + } + +} diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/createTable.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/createTable.json new file mode 100644 index 000000000000..0d5bbc89624a --- /dev/null +++ b/sdk/tables/azure-data-tables/src/test/resources/session-records/createTable.json @@ -0,0 +1,71 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/Tables", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "a9d78bb2-d164-4813-a68a-21b1d869f95a", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:39 GMT", + "Cache-Control" : "no-cache", + "x-ms-request-id" : "a7b4297d-9002-00a7-1ba6-4fbd3f000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables/@Element\",\"TableName\":\"test76690b6b34\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "a9d78bb2-d164-4813-a68a-21b1d869f95a", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/Tables('test76690b6b34')" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.table.core.windows.net/Tables?$format=application/json%3Bodata%3Dminimalmetadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "5c690d2f-1bed-4a8a-b3d5-bd2e16abb60b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad30c2d1-f002-0018-17a6-4f8a9a000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables\",\"value\":[{\"TableName\":\"test76690b6b34\"}]}", + "Date" : "Wed, 01 Jul 2020 12:52:39 GMT", + "x-ms-client-request-id" : "5c690d2f-1bed-4a8a-b3d5-bd2e16abb60b", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.table.core.windows.net/Tables('test76690b6b34')", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "5e96da64-2fbc-4c80-97e0-2a9bc5d027d2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "093a81a1-5002-005c-2fa6-4f00a5000000", + "Date" : "Wed, 01 Jul 2020 12:52:40 GMT", + "x-ms-client-request-id" : "5e96da64-2fbc-4c80-97e0-2a9bc5d027d2" + }, + "Exception" : null + } ], + "variables" : [ "test76690b6b34", "a9d78bb2-d164-4813-a68a-21b1d869f95a", "5c690d2f-1bed-4a8a-b3d5-bd2e16abb60b", "5e96da64-2fbc-4c80-97e0-2a9bc5d027d2" ] +} \ No newline at end of file diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/createTableDuplicateName.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/createTableDuplicateName.json new file mode 100644 index 000000000000..45f7ff918c26 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/test/resources/session-records/createTableDuplicateName.json @@ -0,0 +1,95 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/Tables", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "409a82ad-e287-44d1-a690-5bd4ef967ed6", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:39 GMT", + "Cache-Control" : "no-cache", + "x-ms-request-id" : "ad30c29a-f002-0018-67a6-4f8a9a000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables/@Element\",\"TableName\":\"test58120f3142\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "409a82ad-e287-44d1-a690-5bd4ef967ed6", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/Tables('test58120f3142')" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/Tables", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "fd6fdf4f-e5d8-4103-8701-57186d499031", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "409", + "Date" : "Wed, 01 Jul 2020 12:52:39 GMT", + "Cache-Control" : "no-cache", + "x-ms-request-id" : "a7b42973-9002-00a7-13a6-4fbd3f000000", + "Body" : "{\"odata.error\":{\"code\":\"TableAlreadyExists\",\"message\":{\"lang\":\"en-US\",\"value\":\"The table specified already exists.\\nRequestId:a7b42973-9002-00a7-13a6-4fbd3f000000\\nTime:2020-07-01T12:52:40.2918342Z\"}}}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "fd6fdf4f-e5d8-4103-8701-57186d499031", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.table.core.windows.net/Tables?$format=application/json%3Bodata%3Dminimalmetadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "e65b82b8-5f45-45f5-8782-599e35dce293" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad30c2ab-f002-0018-74a6-4f8a9a000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables\",\"value\":[{\"TableName\":\"test58120f3142\"}]}", + "Date" : "Wed, 01 Jul 2020 12:52:39 GMT", + "x-ms-client-request-id" : "e65b82b8-5f45-45f5-8782-599e35dce293", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.table.core.windows.net/Tables('test58120f3142')", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "2556776e-fbcd-4604-8e29-7704e4d660b8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "a7b42976-9002-00a7-15a6-4fbd3f000000", + "Date" : "Wed, 01 Jul 2020 12:52:39 GMT", + "x-ms-client-request-id" : "2556776e-fbcd-4604-8e29-7704e4d660b8" + }, + "Exception" : null + } ], + "variables" : [ "test58120f3142", "409a82ad-e287-44d1-a690-5bd4ef967ed6", "fd6fdf4f-e5d8-4103-8701-57186d499031", "e65b82b8-5f45-45f5-8782-599e35dce293", "2556776e-fbcd-4604-8e29-7704e4d660b8" ] +} \ No newline at end of file diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/deleteEntity.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/deleteEntity.json new file mode 100644 index 000000000000..a25b9a7b1b4d --- /dev/null +++ b/sdk/tables/azure-data-tables/src/test/resources/session-records/deleteEntity.json @@ -0,0 +1,117 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/Tables", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "faafc5c0-590f-40a3-97f4-ebcfb9000c96", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:39 GMT", + "Cache-Control" : "no-cache", + "x-ms-request-id" : "ad30c273-f002-0018-42a6-4f8a9a000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables/@Element\",\"TableName\":\"test245874b810\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "faafc5c0-590f-40a3-97f4-ebcfb9000c96", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/Tables('test245874b810')" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/test245874b810?timeout=5000", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "624270cf-d95d-4534-90e7-557fc3aa5072", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:39 GMT", + "Cache-Control" : "no-cache", + "ETag" : "W/\"datetime'2020-07-01T12%3A52%3A39.957606Z'\"", + "x-ms-request-id" : "a7b42962-9002-00a7-06a6-4fbd3f000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#test245874b810/@Element\",\"odata.etag\":\"W/\\\"datetime'2020-07-01T12%3A52%3A39.957606Z'\\\"\",\"PartitionKey\":\"partitionkey59485f\",\"RowKey\":\"rowkey62777e872\",\"Timestamp\":\"2020-07-01T12:52:39.957606Z\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "624270cf-d95d-4534-90e7-557fc3aa5072", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/test245874b810(PartitionKey='partitionkey59485f',RowKey='rowkey62777e872')" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.table.core.windows.net/test245874b810(PartitionKey='partitionkey59485f',RowKey='rowkey62777e872')?timeout=5000", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "ccd134fc-ef83-422d-837e-29fc76d2e714" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "ad30c27f-f002-0018-4da6-4f8a9a000000", + "Date" : "Wed, 01 Jul 2020 12:52:39 GMT", + "x-ms-client-request-id" : "ccd134fc-ef83-422d-837e-29fc76d2e714" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.table.core.windows.net/Tables?$format=application/json%3Bodata%3Dminimalmetadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "c141cf5a-fea3-4063-986a-e678ebd1ef73" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "a7b42967-9002-00a7-09a6-4fbd3f000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables\",\"value\":[{\"TableName\":\"test245874b810\"}]}", + "Date" : "Wed, 01 Jul 2020 12:52:39 GMT", + "x-ms-client-request-id" : "c141cf5a-fea3-4063-986a-e678ebd1ef73", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.table.core.windows.net/Tables('test245874b810')", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "a03fed8f-d134-459d-a034-ecc1500936f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "ad30c286-f002-0018-54a6-4f8a9a000000", + "Date" : "Wed, 01 Jul 2020 12:52:39 GMT", + "x-ms-client-request-id" : "a03fed8f-d134-459d-a034-ecc1500936f2" + }, + "Exception" : null + } ], + "variables" : [ "test245874b810", "faafc5c0-590f-40a3-97f4-ebcfb9000c96", "partitionkey59485f", "rowkey62777e872", "ccd134fc-ef83-422d-837e-29fc76d2e714", "624270cf-d95d-4534-90e7-557fc3aa5072", "c141cf5a-fea3-4063-986a-e678ebd1ef73", "a03fed8f-d134-459d-a034-ecc1500936f2" ] +} \ No newline at end of file diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/deleteNonExistentEntity.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/deleteNonExistentEntity.json new file mode 100644 index 000000000000..32ae91b9bf69 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/test/resources/session-records/deleteNonExistentEntity.json @@ -0,0 +1,93 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/Tables", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "8464dcea-160a-4522-be14-d2e36b9c63ea", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:41 GMT", + "Cache-Control" : "no-cache", + "x-ms-request-id" : "093a81b5-5002-005c-3ea6-4f00a5000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables/@Element\",\"TableName\":\"test89907b301b\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "8464dcea-160a-4522-be14-d2e36b9c63ea", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/Tables('test89907b301b')" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.table.core.windows.net/test89907b301b(PartitionKey='partitionkey208848',RowKey='rowkey218589688')?timeout=5000", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "7f7ff35f-5d51-460e-aeb1-51f3c8274fd2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "404", + "x-ms-request-id" : "a7b4299e-9002-00a7-36a6-4fbd3f000000", + "Body" : "{\"odata.error\":{\"code\":\"ResourceNotFound\",\"message\":{\"lang\":\"en-US\",\"value\":\"The specified resource does not exist.\\nRequestId:a7b4299e-9002-00a7-36a6-4fbd3f000000\\nTime:2020-07-01T12:52:41.7468206Z\"}}}", + "Date" : "Wed, 01 Jul 2020 12:52:41 GMT", + "x-ms-client-request-id" : "7f7ff35f-5d51-460e-aeb1-51f3c8274fd2", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.table.core.windows.net/Tables?$format=application/json%3Bodata%3Dminimalmetadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "384b2804-235c-494b-987c-670eb9bdf5d7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad30c31e-f002-0018-5ea6-4f8a9a000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables\",\"value\":[{\"TableName\":\"test89907b301b\"}]}", + "Date" : "Wed, 01 Jul 2020 12:52:40 GMT", + "x-ms-client-request-id" : "384b2804-235c-494b-987c-670eb9bdf5d7", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.table.core.windows.net/Tables('test89907b301b')", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "6ec93e40-fd7b-4493-9a7d-550630d5c052" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "093a81b7-5002-005c-3fa6-4f00a5000000", + "Date" : "Wed, 01 Jul 2020 12:52:41 GMT", + "x-ms-client-request-id" : "6ec93e40-fd7b-4493-9a7d-550630d5c052" + }, + "Exception" : null + } ], + "variables" : [ "test89907b301b", "8464dcea-160a-4522-be14-d2e36b9c63ea", "partitionkey208848", "rowkey218589688", "7f7ff35f-5d51-460e-aeb1-51f3c8274fd2", "384b2804-235c-494b-987c-670eb9bdf5d7", "6ec93e40-fd7b-4493-9a7d-550630d5c052" ] +} \ No newline at end of file diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/deleteNonExistentTable.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/deleteNonExistentTable.json new file mode 100644 index 000000000000..f04c87092323 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/test/resources/session-records/deleteNonExistentTable.json @@ -0,0 +1,48 @@ +{ + "networkCallRecords" : [ { + "Method" : "DELETE", + "Uri" : "https://REDACTED.table.core.windows.net/Tables('test881632ce78')", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "61e7d1cd-7f37-4a62-a9d4-e969489a4706" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "404", + "x-ms-request-id" : "a7b4299c-9002-00a7-34a6-4fbd3f000000", + "Body" : "{\"odata.error\":{\"code\":\"ResourceNotFound\",\"message\":{\"lang\":\"en-US\",\"value\":\"The specified resource does not exist.\\nRequestId:a7b4299c-9002-00a7-34a6-4fbd3f000000\\nTime:2020-07-01T12:52:41.6397487Z\"}}}", + "Date" : "Wed, 01 Jul 2020 12:52:40 GMT", + "x-ms-client-request-id" : "61e7d1cd-7f37-4a62-a9d4-e969489a4706", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.table.core.windows.net/Tables?$format=application/json%3Bodata%3Dminimalmetadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "b1fd53e4-f5db-4f26-ada1-717078c65c32" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad30c318-f002-0018-58a6-4f8a9a000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables\",\"value\":[]}", + "Date" : "Wed, 01 Jul 2020 12:52:40 GMT", + "x-ms-client-request-id" : "b1fd53e4-f5db-4f26-ada1-717078c65c32", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ "test881632ce78", "61e7d1cd-7f37-4a62-a9d4-e969489a4706", "b1fd53e4-f5db-4f26-ada1-717078c65c32" ] +} \ No newline at end of file diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/deleteTable.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/deleteTable.json new file mode 100644 index 000000000000..d0a1c67478c8 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/test/resources/session-records/deleteTable.json @@ -0,0 +1,71 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/Tables", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "e8dd6513-984c-4aca-b603-f2f2104b2e58", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:39 GMT", + "Cache-Control" : "no-cache", + "x-ms-request-id" : "a7b42970-9002-00a7-11a6-4fbd3f000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables/@Element\",\"TableName\":\"test824812e297\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "e8dd6513-984c-4aca-b603-f2f2104b2e58", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/Tables('test824812e297')" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.table.core.windows.net/Tables('test824812e297')", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "2e02dc7f-2073-43e9-b115-d01fe9b5f2bd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "ad30c28c-f002-0018-5aa6-4f8a9a000000", + "Date" : "Wed, 01 Jul 2020 12:52:39 GMT", + "x-ms-client-request-id" : "2e02dc7f-2073-43e9-b115-d01fe9b5f2bd" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.table.core.windows.net/Tables?$format=application/json%3Bodata%3Dminimalmetadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "821a9e14-e040-4a42-a02f-edf44001f228" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "a7b42972-9002-00a7-12a6-4fbd3f000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables\",\"value\":[]}", + "Date" : "Wed, 01 Jul 2020 12:52:39 GMT", + "x-ms-client-request-id" : "821a9e14-e040-4a42-a02f-edf44001f228", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ "test824812e297", "e8dd6513-984c-4aca-b603-f2f2104b2e58", "2e02dc7f-2073-43e9-b115-d01fe9b5f2bd", "821a9e14-e040-4a42-a02f-edf44001f228" ] +} \ No newline at end of file diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/insertNoEtag.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/insertNoEtag.json new file mode 100644 index 000000000000..48c931e6931b --- /dev/null +++ b/sdk/tables/azure-data-tables/src/test/resources/session-records/insertNoEtag.json @@ -0,0 +1,97 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/Tables", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "b96e625c-77ad-4e5c-82cc-01cbaff22837", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:41 GMT", + "Cache-Control" : "no-cache", + "x-ms-request-id" : "093a81a8-5002-005c-34a6-4f00a5000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables/@Element\",\"TableName\":\"test709465a8ae\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "b96e625c-77ad-4e5c-82cc-01cbaff22837", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/Tables('test709465a8ae')" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/test709465a8ae?timeout=5000", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "ff21f7df-3ce1-4000-a360-16a92b215bd6", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:40 GMT", + "Cache-Control" : "no-cache", + "ETag" : "W/\"datetime'2020-07-01T12%3A52%3A41.1924458Z'\"", + "x-ms-request-id" : "a7b42990-9002-00a7-2ba6-4fbd3f000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#test709465a8ae/@Element\",\"odata.etag\":\"W/\\\"datetime'2020-07-01T12%3A52%3A41.1924458Z'\\\"\",\"PartitionKey\":\"partitionkey580821\",\"RowKey\":\"rowkey8284822cb\",\"Timestamp\":\"2020-07-01T12:52:41.1924458Z\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "ff21f7df-3ce1-4000-a360-16a92b215bd6", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/test709465a8ae(PartitionKey='partitionkey580821',RowKey='rowkey8284822cb')" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.table.core.windows.net/Tables?$format=application/json%3Bodata%3Dminimalmetadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "df767a68-a3a3-40fc-b397-216f6056e6ee" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad30c2f8-f002-0018-3ba6-4f8a9a000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables\",\"value\":[{\"TableName\":\"test709465a8ae\"}]}", + "Date" : "Wed, 01 Jul 2020 12:52:40 GMT", + "x-ms-client-request-id" : "df767a68-a3a3-40fc-b397-216f6056e6ee", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.table.core.windows.net/Tables('test709465a8ae')", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "3fd87f61-cc43-4d33-9236-4cd79bbd6a44" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "093a81ac-5002-005c-37a6-4f00a5000000", + "Date" : "Wed, 01 Jul 2020 12:52:41 GMT", + "x-ms-client-request-id" : "3fd87f61-cc43-4d33-9236-4cd79bbd6a44" + }, + "Exception" : null + } ], + "variables" : [ "test709465a8ae", "b96e625c-77ad-4e5c-82cc-01cbaff22837", "partitionkey580821", "rowkey8284822cb", "ff21f7df-3ce1-4000-a360-16a92b215bd6", "df767a68-a3a3-40fc-b397-216f6056e6ee", "3fd87f61-cc43-4d33-9236-4cd79bbd6a44" ] +} \ No newline at end of file diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/mergeEntity.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/mergeEntity.json new file mode 100644 index 000000000000..7d06bcf3c62e --- /dev/null +++ b/sdk/tables/azure-data-tables/src/test/resources/session-records/mergeEntity.json @@ -0,0 +1,119 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/Tables", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "71e298e5-c839-4528-9059-c7f806d29fa3", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:40 GMT", + "Cache-Control" : "no-cache", + "x-ms-request-id" : "a7b42984-9002-00a7-21a6-4fbd3f000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables/@Element\",\"TableName\":\"test745290e4fc\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "71e298e5-c839-4528-9059-c7f806d29fa3", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/Tables('test745290e4fc')" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/test745290e4fc?timeout=5000", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "12a068f7-4fe0-4d2b-a5c7-af9280c2f7cf", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:40 GMT", + "Cache-Control" : "no-cache", + "ETag" : "W/\"datetime'2020-07-01T12%3A52%3A40.8214991Z'\"", + "x-ms-request-id" : "ad30c2d7-f002-0018-1da6-4f8a9a000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#test745290e4fc/@Element\",\"odata.etag\":\"W/\\\"datetime'2020-07-01T12%3A52%3A40.8214991Z'\\\"\",\"PartitionKey\":\"partitionkey47248f\",\"RowKey\":\"rowkey009805dad\",\"Timestamp\":\"2020-07-01T12:52:40.8214991Z\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "12a068f7-4fe0-4d2b-a5c7-af9280c2f7cf", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/test745290e4fc(PartitionKey='partitionkey47248f',RowKey='rowkey009805dad')" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.table.core.windows.net/test745290e4fc(PartitionKey='partitionkey47248f',RowKey='rowkey009805dad')?timeout=5000", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "0049a02f-1e93-4b0a-a7e1-8f886878baa1", + "Content-Type" : "application/json" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "ETag" : "W/\"datetime'2020-07-01T12%3A52%3A40.8629359Z'\"", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "093a81a3-5002-005c-31a6-4f00a5000000", + "Date" : "Wed, 01 Jul 2020 12:52:40 GMT", + "x-ms-client-request-id" : "0049a02f-1e93-4b0a-a7e1-8f886878baa1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.table.core.windows.net/Tables?$format=application/json%3Bodata%3Dminimalmetadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "8b78b847-eb4b-4476-82f3-b43dc21281ee" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "a7b42988-9002-00a7-24a6-4fbd3f000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables\",\"value\":[{\"TableName\":\"test745290e4fc\"}]}", + "Date" : "Wed, 01 Jul 2020 12:52:40 GMT", + "x-ms-client-request-id" : "8b78b847-eb4b-4476-82f3-b43dc21281ee", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.table.core.windows.net/Tables('test745290e4fc')", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "9f5787b2-5335-48d3-8cdf-cc5fd77d4d38" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "ad30c2dd-f002-0018-22a6-4f8a9a000000", + "Date" : "Wed, 01 Jul 2020 12:52:40 GMT", + "x-ms-client-request-id" : "9f5787b2-5335-48d3-8cdf-cc5fd77d4d38" + }, + "Exception" : null + } ], + "variables" : [ "test745290e4fc", "71e298e5-c839-4528-9059-c7f806d29fa3", "partitionkey47248f", "rowkey009805dad", "0049a02f-1e93-4b0a-a7e1-8f886878baa1", "12a068f7-4fe0-4d2b-a5c7-af9280c2f7cf", "dd2a873956ce4f0e", "8b78b847-eb4b-4476-82f3-b43dc21281ee", "9f5787b2-5335-48d3-8cdf-cc5fd77d4d38" ] +} \ No newline at end of file diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/mergeNonExistentEntity.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/mergeNonExistentEntity.json new file mode 100644 index 000000000000..c77796323013 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/test/resources/session-records/mergeNonExistentEntity.json @@ -0,0 +1,94 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/Tables", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "301b8e99-69ca-4c62-a03e-6206aed65304", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:38 GMT", + "Cache-Control" : "no-cache", + "x-ms-request-id" : "ad30c261-f002-0018-32a6-4f8a9a000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables/@Element\",\"TableName\":\"test64434b87bf\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "301b8e99-69ca-4c62-a03e-6206aed65304", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/Tables('test64434b87bf')" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.table.core.windows.net/test64434b87bf(PartitionKey='partitionkey223364',RowKey='rowkey2745830d2')?timeout=5000", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "e5e62ece-8996-4f2d-abd4-437c45a80aad", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "404", + "x-ms-request-id" : "a7b42955-9002-00a7-7aa6-4fbd3f000000", + "Body" : "{\"odata.error\":{\"code\":\"ResourceNotFound\",\"message\":{\"lang\":\"en-US\",\"value\":\"The specified resource does not exist.\\nRequestId:a7b42955-9002-00a7-7aa6-4fbd3f000000\\nTime:2020-07-01T12:52:39.8135080Z\"}}}", + "Date" : "Wed, 01 Jul 2020 12:52:39 GMT", + "x-ms-client-request-id" : "e5e62ece-8996-4f2d-abd4-437c45a80aad", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.table.core.windows.net/Tables?$format=application/json%3Bodata%3Dminimalmetadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "591ca6f1-7768-447a-8d32-800669d83f0b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad30c26b-f002-0018-3ba6-4f8a9a000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables\",\"value\":[{\"TableName\":\"test64434b87bf\"}]}", + "Date" : "Wed, 01 Jul 2020 12:52:39 GMT", + "x-ms-client-request-id" : "591ca6f1-7768-447a-8d32-800669d83f0b", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.table.core.windows.net/Tables('test64434b87bf')", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "cdf4d28d-1808-4511-8016-3c0ab4f39d59" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "a7b4295c-9002-00a7-80a6-4fbd3f000000", + "Date" : "Wed, 01 Jul 2020 12:52:39 GMT", + "x-ms-client-request-id" : "cdf4d28d-1808-4511-8016-3c0ab4f39d59" + }, + "Exception" : null + } ], + "variables" : [ "test64434b87bf", "301b8e99-69ca-4c62-a03e-6206aed65304", "partitionkey223364", "rowkey2745830d2", "e5e62ece-8996-4f2d-abd4-437c45a80aad", "591ca6f1-7768-447a-8d32-800669d83f0b", "cdf4d28d-1808-4511-8016-3c0ab4f39d59" ] +} \ No newline at end of file diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/queryEntitiesWithPartitionAndRowKey.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/queryEntitiesWithPartitionAndRowKey.json new file mode 100644 index 000000000000..899365e47b0b --- /dev/null +++ b/sdk/tables/azure-data-tables/src/test/resources/session-records/queryEntitiesWithPartitionAndRowKey.json @@ -0,0 +1,120 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/Tables", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "32944c6a-6cc0-4205-ada4-e8cb6d089087", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:40 GMT", + "Cache-Control" : "no-cache", + "x-ms-request-id" : "ad30c30a-f002-0018-4ba6-4f8a9a000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables/@Element\",\"TableName\":\"test15500468dc\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "32944c6a-6cc0-4205-ada4-e8cb6d089087", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/Tables('test15500468dc')" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/test15500468dc?timeout=5000", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "b1ff3069-6dd1-490b-b946-2cf3d7e6dd91", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:41 GMT", + "Cache-Control" : "no-cache", + "ETag" : "W/\"datetime'2020-07-01T12%3A52%3A41.4917242Z'\"", + "x-ms-request-id" : "093a81b1-5002-005c-3ca6-4f00a5000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#test15500468dc/@Element\",\"odata.etag\":\"W/\\\"datetime'2020-07-01T12%3A52%3A41.4917242Z'\\\"\",\"PartitionKey\":\"partitionkey919688\",\"RowKey\":\"rowkey745419b2d\",\"Timestamp\":\"2020-07-01T12:52:41.4917242Z\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "b1ff3069-6dd1-490b-b946-2cf3d7e6dd91", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/test15500468dc(PartitionKey='partitionkey919688',RowKey='rowkey745419b2d')" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.table.core.windows.net/test15500468dc(PartitionKey='partitionkey919688',RowKey='rowkey745419b2d')?timeout=5000&$format=application/json%3Bodata%3Dfullmetadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "97019a59-d27d-4d13-b68b-3317a67fe8e0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Wed, 01 Jul 2020 12:52:40 GMT", + "Cache-Control" : "no-cache", + "ETag" : "W/\"datetime'2020-07-01T12%3A52%3A41.4917242Z'\"", + "x-ms-request-id" : "a7b4299a-9002-00a7-33a6-4fbd3f000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#test15500468dc/@Element\",\"odata.type\":\"telboytrial.test15500468dc\",\"odata.id\":\"https://telboytrial.table.core.windows.net/test15500468dc(PartitionKey='partitionkey919688',RowKey='rowkey745419b2d')\",\"odata.etag\":\"W/\\\"datetime'2020-07-01T12%3A52%3A41.4917242Z'\\\"\",\"odata.editLink\":\"test15500468dc(PartitionKey='partitionkey919688',RowKey='rowkey745419b2d')\",\"PartitionKey\":\"partitionkey919688\",\"RowKey\":\"rowkey745419b2d\",\"Timestamp@odata.type\":\"Edm.DateTime\",\"Timestamp\":\"2020-07-01T12:52:41.4917242Z\"}", + "x-ms-client-request-id" : "97019a59-d27d-4d13-b68b-3317a67fe8e0", + "Content-Type" : "application/json;odata=fullmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.table.core.windows.net/Tables?$format=application/json%3Bodata%3Dminimalmetadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "0fc71aea-dec3-4afb-9180-f1007e031de5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad30c312-f002-0018-52a6-4f8a9a000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables\",\"value\":[{\"TableName\":\"test15500468dc\"}]}", + "Date" : "Wed, 01 Jul 2020 12:52:40 GMT", + "x-ms-client-request-id" : "0fc71aea-dec3-4afb-9180-f1007e031de5", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.table.core.windows.net/Tables('test15500468dc')", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "91e1e3f0-735a-4a55-9d48-43b394164315" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "093a81b4-5002-005c-3da6-4f00a5000000", + "Date" : "Wed, 01 Jul 2020 12:52:41 GMT", + "x-ms-client-request-id" : "91e1e3f0-735a-4a55-9d48-43b394164315" + }, + "Exception" : null + } ], + "variables" : [ "test15500468dc", "32944c6a-6cc0-4205-ada4-e8cb6d089087", "partitionkey919688", "rowkey745419b2d", "b1ff3069-6dd1-490b-b946-2cf3d7e6dd91", "97019a59-d27d-4d13-b68b-3317a67fe8e0", "0fc71aea-dec3-4afb-9180-f1007e031de5", "91e1e3f0-735a-4a55-9d48-43b394164315" ] +} \ No newline at end of file diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/queryEntity.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/queryEntity.json new file mode 100644 index 000000000000..fa3d704d7dc9 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/test/resources/session-records/queryEntity.json @@ -0,0 +1,145 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/Tables", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "feaa79a2-f371-43cd-82da-16db350de78e", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:38 GMT", + "Cache-Control" : "no-cache", + "x-ms-request-id" : "a7b42905-9002-00a7-33a6-4fbd3f000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables/@Element\",\"TableName\":\"test39546bcdb2\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "feaa79a2-f371-43cd-82da-16db350de78e", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/Tables('test39546bcdb2')" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/test39546bcdb2?timeout=5000", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "425426f6-366e-4d3b-bcb1-76e3e4c049c5", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:38 GMT", + "Cache-Control" : "no-cache", + "ETag" : "W/\"datetime'2020-07-01T12%3A52%3A38.9901948Z'\"", + "x-ms-request-id" : "ad30c21e-f002-0018-77a6-4f8a9a000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#test39546bcdb2/@Element\",\"odata.etag\":\"W/\\\"datetime'2020-07-01T12%3A52%3A38.9901948Z'\\\"\",\"PartitionKey\":\"partitionkeya18693a\",\"RowKey\":\"rowkeya648351502\",\"Timestamp\":\"2020-07-01T12:52:38.9901948Z\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "425426f6-366e-4d3b-bcb1-76e3e4c049c5", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/test39546bcdb2(PartitionKey='partitionkeya18693a',RowKey='rowkeya648351502')" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/test39546bcdb2?timeout=5000", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "8ea2563b-487a-42b2-947c-74e7ea6844e3", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:38 GMT", + "Cache-Control" : "no-cache", + "ETag" : "W/\"datetime'2020-07-01T12%3A52%3A39.0259727Z'\"", + "x-ms-request-id" : "a7b4290b-9002-00a7-38a6-4fbd3f000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#test39546bcdb2/@Element\",\"odata.etag\":\"W/\\\"datetime'2020-07-01T12%3A52%3A39.0259727Z'\\\"\",\"PartitionKey\":\"partitionkeyb950639\",\"RowKey\":\"rowkeyb2421336ba\",\"Timestamp\":\"2020-07-01T12:52:39.0259727Z\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "8ea2563b-487a-42b2-947c-74e7ea6844e3", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/test39546bcdb2(PartitionKey='partitionkeyb950639',RowKey='rowkeyb2421336ba')" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.table.core.windows.net/test39546bcdb2()?timeout=5000&$format=application/json%3Bodata%3Dfullmetadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "d3c82523-db05-42a3-8132-bafca143a596" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad30c227-f002-0018-7da6-4f8a9a000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#test39546bcdb2\",\"value\":[{\"odata.type\":\"telboytrial.test39546bcdb2\",\"odata.id\":\"https://telboytrial.table.core.windows.net/test39546bcdb2(PartitionKey='partitionkeya18693a',RowKey='rowkeya648351502')\",\"odata.etag\":\"W/\\\"datetime'2020-07-01T12%3A52%3A38.9901948Z'\\\"\",\"odata.editLink\":\"test39546bcdb2(PartitionKey='partitionkeya18693a',RowKey='rowkeya648351502')\",\"PartitionKey\":\"partitionkeya18693a\",\"RowKey\":\"rowkeya648351502\",\"Timestamp@odata.type\":\"Edm.DateTime\",\"Timestamp\":\"2020-07-01T12:52:38.9901948Z\"},{\"odata.type\":\"telboytrial.test39546bcdb2\",\"odata.id\":\"https://telboytrial.table.core.windows.net/test39546bcdb2(PartitionKey='partitionkeyb950639',RowKey='rowkeyb2421336ba')\",\"odata.etag\":\"W/\\\"datetime'2020-07-01T12%3A52%3A39.0259727Z'\\\"\",\"odata.editLink\":\"test39546bcdb2(PartitionKey='partitionkeyb950639',RowKey='rowkeyb2421336ba')\",\"PartitionKey\":\"partitionkeyb950639\",\"RowKey\":\"rowkeyb2421336ba\",\"Timestamp@odata.type\":\"Edm.DateTime\",\"Timestamp\":\"2020-07-01T12:52:39.0259727Z\"}]}", + "Date" : "Wed, 01 Jul 2020 12:52:38 GMT", + "x-ms-client-request-id" : "d3c82523-db05-42a3-8132-bafca143a596", + "Content-Type" : "application/json;odata=fullmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.table.core.windows.net/Tables?$format=application/json%3Bodata%3Dminimalmetadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "360ce089-b9d9-46de-a719-c6ab14840f76" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "a7b42919-9002-00a7-44a6-4fbd3f000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables\",\"value\":[{\"TableName\":\"test39546bcdb2\"}]}", + "Date" : "Wed, 01 Jul 2020 12:52:38 GMT", + "x-ms-client-request-id" : "360ce089-b9d9-46de-a719-c6ab14840f76", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.table.core.windows.net/Tables('test39546bcdb2')", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "5b5d25d6-101f-43b2-95fa-3a969e922205" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "ad30c231-f002-0018-05a6-4f8a9a000000", + "Date" : "Wed, 01 Jul 2020 12:52:38 GMT", + "x-ms-client-request-id" : "5b5d25d6-101f-43b2-95fa-3a969e922205" + }, + "Exception" : null + } ], + "variables" : [ "d3c82523-db05-42a3-8132-bafca143a596", "test39546bcdb2", "feaa79a2-f371-43cd-82da-16db350de78e", "partitionkeya18693a", "rowkeya648351502", "425426f6-366e-4d3b-bcb1-76e3e4c049c5", "partitionkeyb950639", "rowkeyb2421336ba", "8ea2563b-487a-42b2-947c-74e7ea6844e3", "360ce089-b9d9-46de-a719-c6ab14840f76", "5b5d25d6-101f-43b2-95fa-3a969e922205" ] +} \ No newline at end of file diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/queryEntityWithFilter.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/queryEntityWithFilter.json new file mode 100644 index 000000000000..70f032f32508 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/test/resources/session-records/queryEntityWithFilter.json @@ -0,0 +1,119 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/Tables", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "fa5f279a-f9de-43a9-ab5e-f6e670bc5a81", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:37 GMT", + "Cache-Control" : "no-cache", + "x-ms-request-id" : "a7b428e4-9002-00a7-18a6-4fbd3f000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables/@Element\",\"TableName\":\"test16410dc76b\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "fa5f279a-f9de-43a9-ab5e-f6e670bc5a81", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/Tables('test16410dc76b')" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/test16410dc76b?timeout=5000", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "99facfde-f2f2-439d-af41-eb234ad456a1", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:37 GMT", + "Cache-Control" : "no-cache", + "ETag" : "W/\"datetime'2020-07-01T12%3A52%3A38.5556524Z'\"", + "x-ms-request-id" : "a7b428f4-9002-00a7-22a6-4fbd3f000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#test16410dc76b/@Element\",\"odata.etag\":\"W/\\\"datetime'2020-07-01T12%3A52%3A38.5556524Z'\\\"\",\"PartitionKey\":\"partitionkeya52522a\",\"RowKey\":\"rowkeya5870843ae\",\"Timestamp\":\"2020-07-01T12:52:38.5556524Z\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "99facfde-f2f2-439d-af41-eb234ad456a1", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/test16410dc76b(PartitionKey='partitionkeya52522a',RowKey='rowkeya5870843ae')" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.table.core.windows.net/test16410dc76b()?timeout=5000&$format=application/json%3Bodata%3Dfullmetadata&$select=PartitionKeyeqpartitionkeya52522a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "64b80104-3a4c-400d-ba72-c49075f2e2ca" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "a7b428f7-9002-00a7-25a6-4fbd3f000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#test16410dc76b&$select=PartitionKeyeqpartitionkeya52522a\",\"value\":[{\"odata.type\":\"telboytrial.test16410dc76b\",\"odata.id\":\"https://telboytrial.table.core.windows.net/test16410dc76b(PartitionKey='partitionkeya52522a',RowKey='rowkeya5870843ae')\",\"odata.etag\":\"W/\\\"datetime'2020-07-01T12%3A52%3A38.5556524Z'\\\"\",\"odata.editLink\":\"test16410dc76b(PartitionKey='partitionkeya52522a',RowKey='rowkeya5870843ae')\",\"PartitionKeyeqpartitionkeya52522a\":null}]}", + "Date" : "Wed, 01 Jul 2020 12:52:37 GMT", + "x-ms-client-request-id" : "64b80104-3a4c-400d-ba72-c49075f2e2ca", + "Content-Type" : "application/json;odata=fullmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.table.core.windows.net/Tables?$format=application/json%3Bodata%3Dminimalmetadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "dac0dce8-b1ff-4ea8-a704-59f98ffc2812" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "a7b428fa-9002-00a7-28a6-4fbd3f000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables\",\"value\":[{\"TableName\":\"test16410dc76b\"}]}", + "Date" : "Wed, 01 Jul 2020 12:52:37 GMT", + "x-ms-client-request-id" : "dac0dce8-b1ff-4ea8-a704-59f98ffc2812", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.table.core.windows.net/Tables('test16410dc76b')", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "569436a7-afa3-448e-b73f-a9f02221d11d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "ad30c214-f002-0018-6ea6-4f8a9a000000", + "Date" : "Wed, 01 Jul 2020 12:52:38 GMT", + "x-ms-client-request-id" : "569436a7-afa3-448e-b73f-a9f02221d11d" + }, + "Exception" : null + } ], + "variables" : [ "64b80104-3a4c-400d-ba72-c49075f2e2ca", "test16410dc76b", "fa5f279a-f9de-43a9-ab5e-f6e670bc5a81", "partitionkeya52522a", "rowkeya5870843ae", "99facfde-f2f2-439d-af41-eb234ad456a1", "dac0dce8-b1ff-4ea8-a704-59f98ffc2812", "569436a7-afa3-448e-b73f-a9f02221d11d" ] +} \ No newline at end of file diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/queryEntityWithSelect.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/queryEntityWithSelect.json new file mode 100644 index 000000000000..bdfed955aca6 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/test/resources/session-records/queryEntityWithSelect.json @@ -0,0 +1,145 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/Tables", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "20f2e3e7-8c5b-404e-a83d-d5261fdc7fd1", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:38 GMT", + "Cache-Control" : "no-cache", + "x-ms-request-id" : "a7b4291f-9002-00a7-4aa6-4fbd3f000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables/@Element\",\"TableName\":\"test804717a76b\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "20f2e3e7-8c5b-404e-a83d-d5261fdc7fd1", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/Tables('test804717a76b')" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/test804717a76b?timeout=5000", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "2e55ea16-a416-4391-93fc-785127f6a336", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:38 GMT", + "Cache-Control" : "no-cache", + "ETag" : "W/\"datetime'2020-07-01T12%3A52%3A39.2383714Z'\"", + "x-ms-request-id" : "ad30c237-f002-0018-0ba6-4f8a9a000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#test804717a76b/@Element\",\"odata.etag\":\"W/\\\"datetime'2020-07-01T12%3A52%3A39.2383714Z'\\\"\",\"PartitionKey\":\"partitionkeya938347\",\"RowKey\":\"rowkeya839234295\",\"Timestamp\":\"2020-07-01T12:52:39.2383714Z\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "2e55ea16-a416-4391-93fc-785127f6a336", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/test804717a76b(PartitionKey='partitionkeya938347',RowKey='rowkeya839234295')" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/test804717a76b?timeout=5000", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "65f5dce9-21be-4462-bd3f-6736343767a5", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:38 GMT", + "Cache-Control" : "no-cache", + "ETag" : "W/\"datetime'2020-07-01T12%3A52%3A39.280146Z'\"", + "x-ms-request-id" : "a7b4292b-9002-00a7-55a6-4fbd3f000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#test804717a76b/@Element\",\"odata.etag\":\"W/\\\"datetime'2020-07-01T12%3A52%3A39.280146Z'\\\"\",\"PartitionKey\":\"partitionkeyb202403\",\"RowKey\":\"rowkeyb00625d7c9\",\"Timestamp\":\"2020-07-01T12:52:39.280146Z\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "65f5dce9-21be-4462-bd3f-6736343767a5", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/test804717a76b(PartitionKey='partitionkeyb202403',RowKey='rowkeyb00625d7c9')" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.table.core.windows.net/test804717a76b()?timeout=5000&$format=application/json%3Bodata%3Dfullmetadata&$select=RowKey", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "4bc9fc6b-09cf-494e-b91c-c1959b93f02b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad30c23f-f002-0018-12a6-4f8a9a000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#test804717a76b&$select=RowKey\",\"value\":[{\"odata.type\":\"telboytrial.test804717a76b\",\"odata.id\":\"https://telboytrial.table.core.windows.net/test804717a76b(PartitionKey='partitionkeya938347',RowKey='rowkeya839234295')\",\"odata.etag\":\"W/\\\"datetime'2020-07-01T12%3A52%3A39.2383714Z'\\\"\",\"odata.editLink\":\"test804717a76b(PartitionKey='partitionkeya938347',RowKey='rowkeya839234295')\",\"RowKey\":\"rowkeya839234295\"},{\"odata.type\":\"telboytrial.test804717a76b\",\"odata.id\":\"https://telboytrial.table.core.windows.net/test804717a76b(PartitionKey='partitionkeyb202403',RowKey='rowkeyb00625d7c9')\",\"odata.etag\":\"W/\\\"datetime'2020-07-01T12%3A52%3A39.280146Z'\\\"\",\"odata.editLink\":\"test804717a76b(PartitionKey='partitionkeyb202403',RowKey='rowkeyb00625d7c9')\",\"RowKey\":\"rowkeyb00625d7c9\"}]}", + "Date" : "Wed, 01 Jul 2020 12:52:38 GMT", + "x-ms-client-request-id" : "4bc9fc6b-09cf-494e-b91c-c1959b93f02b", + "Content-Type" : "application/json;odata=fullmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.table.core.windows.net/Tables?$format=application/json%3Bodata%3Dminimalmetadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "e94f1b63-444b-422e-b5a0-2f153347edc1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "a7b42931-9002-00a7-5ba6-4fbd3f000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables\",\"value\":[{\"TableName\":\"test804717a76b\"}]}", + "Date" : "Wed, 01 Jul 2020 12:52:38 GMT", + "x-ms-client-request-id" : "e94f1b63-444b-422e-b5a0-2f153347edc1", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.table.core.windows.net/Tables('test804717a76b')", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "a0f62d48-3844-4ae0-94ef-964d36d30034" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "ad30c243-f002-0018-16a6-4f8a9a000000", + "Date" : "Wed, 01 Jul 2020 12:52:38 GMT", + "x-ms-client-request-id" : "a0f62d48-3844-4ae0-94ef-964d36d30034" + }, + "Exception" : null + } ], + "variables" : [ "4bc9fc6b-09cf-494e-b91c-c1959b93f02b", "test804717a76b", "20f2e3e7-8c5b-404e-a83d-d5261fdc7fd1", "partitionkeya938347", "rowkeya839234295", "2e55ea16-a416-4391-93fc-785127f6a336", "partitionkeyb202403", "rowkeyb00625d7c9", "65f5dce9-21be-4462-bd3f-6736343767a5", "e94f1b63-444b-422e-b5a0-2f153347edc1", "a0f62d48-3844-4ae0-94ef-964d36d30034" ] +} \ No newline at end of file diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/queryEntityWithTop.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/queryEntityWithTop.json new file mode 100644 index 000000000000..9ec2f5951763 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/test/resources/session-records/queryEntityWithTop.json @@ -0,0 +1,93 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/Tables", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "bdc0fab6-7a19-4191-93ea-1892ef601015", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:38 GMT", + "Cache-Control" : "no-cache", + "x-ms-request-id" : "a7b42938-9002-00a7-61a6-4fbd3f000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables/@Element\",\"TableName\":\"test14071c6635\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "bdc0fab6-7a19-4191-93ea-1892ef601015", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/Tables('test14071c6635')" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.table.core.windows.net/test14071c6635()?timeout=5000&$format=application/json%3Bodata%3Dfullmetadata&$top=0", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "5721d6ef-c1e8-4729-8f7e-ca0520778ba2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad30c249-f002-0018-1ca6-4f8a9a000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#test14071c6635\",\"value\":[]}", + "Date" : "Wed, 01 Jul 2020 12:52:38 GMT", + "x-ms-client-request-id" : "5721d6ef-c1e8-4729-8f7e-ca0520778ba2", + "Content-Type" : "application/json;odata=fullmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.table.core.windows.net/Tables?$format=application/json%3Bodata%3Dminimalmetadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "0367e980-ed8d-448b-8096-4bd6abc6b58a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "a7b4293d-9002-00a7-65a6-4fbd3f000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables\",\"value\":[{\"TableName\":\"test14071c6635\"}]}", + "Date" : "Wed, 01 Jul 2020 12:52:38 GMT", + "x-ms-client-request-id" : "0367e980-ed8d-448b-8096-4bd6abc6b58a", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.table.core.windows.net/Tables('test14071c6635')", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "2b3f0ad8-5cca-47c1-8d30-8f622b8c2a93" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "ad30c24e-f002-0018-20a6-4f8a9a000000", + "Date" : "Wed, 01 Jul 2020 12:52:38 GMT", + "x-ms-client-request-id" : "2b3f0ad8-5cca-47c1-8d30-8f622b8c2a93" + }, + "Exception" : null + } ], + "variables" : [ "5721d6ef-c1e8-4729-8f7e-ca0520778ba2", "test14071c6635", "bdc0fab6-7a19-4191-93ea-1892ef601015", "0367e980-ed8d-448b-8096-4bd6abc6b58a", "2b3f0ad8-5cca-47c1-8d30-8f622b8c2a93" ] +} \ No newline at end of file diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/queryTable.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/queryTable.json new file mode 100644 index 000000000000..e7903c311e59 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/test/resources/session-records/queryTable.json @@ -0,0 +1,138 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/Tables", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "77786073-56cf-42b7-a61a-da070c403604", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:40 GMT", + "Cache-Control" : "no-cache", + "x-ms-request-id" : "093a81a5-5002-005c-32a6-4f00a5000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables/@Element\",\"TableName\":\"atesta467458233\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "77786073-56cf-42b7-a61a-da070c403604", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/Tables('atesta467458233')" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/Tables", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "135a7f14-fe28-49f2-9252-a25d10dfebd7", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:40 GMT", + "Cache-Control" : "no-cache", + "x-ms-request-id" : "a7b4298b-9002-00a7-27a6-4fbd3f000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables/@Element\",\"TableName\":\"btestb450627457\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "135a7f14-fe28-49f2-9252-a25d10dfebd7", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/Tables('btestb450627457')" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.table.core.windows.net/Tables?$format=application/json%3Bodata%3Dminimalmetadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "6fc2e7ed-3c0d-401d-93b2-351725baeb74" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad30c2e4-f002-0018-29a6-4f8a9a000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables\",\"value\":[{\"TableName\":\"atesta467458233\"},{\"TableName\":\"btestb450627457\"}]}", + "Date" : "Wed, 01 Jul 2020 12:52:40 GMT", + "x-ms-client-request-id" : "6fc2e7ed-3c0d-401d-93b2-351725baeb74", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.table.core.windows.net/Tables?$format=application/json%3Bodata%3Dminimalmetadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "aafd20ad-99b4-4698-a298-77ffb0610937" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "093a81a7-5002-005c-33a6-4f00a5000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables\",\"value\":[{\"TableName\":\"atesta467458233\"},{\"TableName\":\"btestb450627457\"}]}", + "Date" : "Wed, 01 Jul 2020 12:52:41 GMT", + "x-ms-client-request-id" : "aafd20ad-99b4-4698-a298-77ffb0610937", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.table.core.windows.net/Tables('atesta467458233')", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "1adcd7f8-ae5d-4d85-8b75-cf7dc7e5a605" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "a7b4298e-9002-00a7-29a6-4fbd3f000000", + "Date" : "Wed, 01 Jul 2020 12:52:40 GMT", + "x-ms-client-request-id" : "1adcd7f8-ae5d-4d85-8b75-cf7dc7e5a605" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.table.core.windows.net/Tables('btestb450627457')", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "848749a5-30f4-4de5-8d1b-c60f00ed547b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "ad30c2ed-f002-0018-30a6-4f8a9a000000", + "Date" : "Wed, 01 Jul 2020 12:52:40 GMT", + "x-ms-client-request-id" : "848749a5-30f4-4de5-8d1b-c60f00ed547b" + }, + "Exception" : null + } ], + "variables" : [ "atesta467458233", "btestb450627457", "77786073-56cf-42b7-a61a-da070c403604", "135a7f14-fe28-49f2-9252-a25d10dfebd7", "6fc2e7ed-3c0d-401d-93b2-351725baeb74", "aafd20ad-99b4-4698-a298-77ffb0610937", "1adcd7f8-ae5d-4d85-8b75-cf7dc7e5a605", "848749a5-30f4-4de5-8d1b-c60f00ed547b" ] +} \ No newline at end of file diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/queryTablewithTop.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/queryTablewithTop.json new file mode 100644 index 000000000000..5fe4ef604300 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/test/resources/session-records/queryTablewithTop.json @@ -0,0 +1,139 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/Tables", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "848bd698-011a-46ed-a001-7aafa978d96a", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:39 GMT", + "Cache-Control" : "no-cache", + "x-ms-request-id" : "ad30c2b2-f002-0018-7ba6-4f8a9a000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables/@Element\",\"TableName\":\"atesta47573650a\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "848bd698-011a-46ed-a001-7aafa978d96a", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/Tables('atesta47573650a')" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/Tables", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "cceecbc5-ea58-4939-bba3-f7b0f9e157c6", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:39 GMT", + "Cache-Control" : "no-cache", + "x-ms-request-id" : "a7b42979-9002-00a7-18a6-4fbd3f000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables/@Element\",\"TableName\":\"btestb491748d98\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "cceecbc5-ea58-4939-bba3-f7b0f9e157c6", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/Tables('btestb491748d98')" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.table.core.windows.net/Tables?$format=application/json%3Bodata%3Dminimalmetadata&$top=1", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "7c98cfbf-7d63-4aa3-b1c1-382abdfdf3ac" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Wed, 01 Jul 2020 12:52:39 GMT", + "x-ms-continuation-NextTableName" : "1!44!YnRlc3RiNDkxNzQ4ZDk4ATAxZDY0ZmE2ODEyYzZhYTI-", + "Cache-Control" : "no-cache", + "x-ms-request-id" : "ad30c2b9-f002-0018-01a6-4f8a9a000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables\",\"value\":[{\"TableName\":\"atesta47573650a\"}]}", + "x-ms-client-request-id" : "7c98cfbf-7d63-4aa3-b1c1-382abdfdf3ac", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.table.core.windows.net/Tables?$format=application/json%3Bodata%3Dminimalmetadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "a5f700a0-9946-40e3-b0e5-9a387627abc0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "a7b4297b-9002-00a7-19a6-4fbd3f000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables\",\"value\":[{\"TableName\":\"atesta47573650a\"},{\"TableName\":\"btestb491748d98\"}]}", + "Date" : "Wed, 01 Jul 2020 12:52:39 GMT", + "x-ms-client-request-id" : "a5f700a0-9946-40e3-b0e5-9a387627abc0", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.table.core.windows.net/Tables('atesta47573650a')", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "31f06f8f-7930-451c-8d51-8fd144aa32b5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "ad30c2c2-f002-0018-09a6-4f8a9a000000", + "Date" : "Wed, 01 Jul 2020 12:52:39 GMT", + "x-ms-client-request-id" : "31f06f8f-7930-451c-8d51-8fd144aa32b5" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.table.core.windows.net/Tables('btestb491748d98')", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "c8ee9b8f-5104-4ea6-8d1a-1880c2ae7b7f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "093a819b-5002-005c-2aa6-4f00a5000000", + "Date" : "Wed, 01 Jul 2020 12:52:40 GMT", + "x-ms-client-request-id" : "c8ee9b8f-5104-4ea6-8d1a-1880c2ae7b7f" + }, + "Exception" : null + } ], + "variables" : [ "atesta47573650a", "btestb491748d98", "848bd698-011a-46ed-a001-7aafa978d96a", "cceecbc5-ea58-4939-bba3-f7b0f9e157c6", "7c98cfbf-7d63-4aa3-b1c1-382abdfdf3ac", "a5f700a0-9946-40e3-b0e5-9a387627abc0", "31f06f8f-7930-451c-8d51-8fd144aa32b5", "c8ee9b8f-5104-4ea6-8d1a-1880c2ae7b7f" ] +} \ No newline at end of file diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/updateEntity.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/updateEntity.json new file mode 100644 index 000000000000..265d9f2ff8b6 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/test/resources/session-records/updateEntity.json @@ -0,0 +1,119 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/Tables", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "b0a7672c-2802-45ec-a0e5-c7f601fcc6d5", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:38 GMT", + "Cache-Control" : "no-cache", + "x-ms-request-id" : "a7b42940-9002-00a7-68a6-4fbd3f000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables/@Element\",\"TableName\":\"test28489451d8\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "b0a7672c-2802-45ec-a0e5-c7f601fcc6d5", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/Tables('test28489451d8')" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/test28489451d8?timeout=5000", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "5b0f2001-9eee-49ec-9d42-f5581e2cb141", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:38 GMT", + "Cache-Control" : "no-cache", + "ETag" : "W/\"datetime'2020-07-01T12%3A52%3A39.6146392Z'\"", + "x-ms-request-id" : "ad30c257-f002-0018-29a6-4f8a9a000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#test28489451d8/@Element\",\"odata.etag\":\"W/\\\"datetime'2020-07-01T12%3A52%3A39.6146392Z'\\\"\",\"PartitionKey\":\"partitionkey202594\",\"RowKey\":\"rowkey88272bdb9\",\"Timestamp\":\"2020-07-01T12:52:39.6146392Z\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "5b0f2001-9eee-49ec-9d42-f5581e2cb141", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/test28489451d8(PartitionKey='partitionkey202594',RowKey='rowkey88272bdb9')" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.table.core.windows.net/test28489451d8(PartitionKey='partitionkey202594',RowKey='rowkey88272bdb9')?timeout=5000", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "dea79b44-d15d-45d5-9f3e-8b836c225509", + "Content-Type" : "application/json" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "ETag" : "W/\"datetime'2020-07-01T12%3A52%3A39.6510734Z'\"", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "a7b42947-9002-00a7-6ea6-4fbd3f000000", + "Date" : "Wed, 01 Jul 2020 12:52:38 GMT", + "x-ms-client-request-id" : "dea79b44-d15d-45d5-9f3e-8b836c225509" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.table.core.windows.net/Tables?$format=application/json%3Bodata%3Dminimalmetadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "5d8f9dc0-c148-48bd-87f0-0ef93bb0f305" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad30c25c-f002-0018-2da6-4f8a9a000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables\",\"value\":[{\"TableName\":\"test28489451d8\"}]}", + "Date" : "Wed, 01 Jul 2020 12:52:38 GMT", + "x-ms-client-request-id" : "5d8f9dc0-c148-48bd-87f0-0ef93bb0f305", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.table.core.windows.net/Tables('test28489451d8')", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "208bfe9b-e6ab-4d29-a15c-35e8ab9bdebe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "a7b42950-9002-00a7-76a6-4fbd3f000000", + "Date" : "Wed, 01 Jul 2020 12:52:38 GMT", + "x-ms-client-request-id" : "208bfe9b-e6ab-4d29-a15c-35e8ab9bdebe" + }, + "Exception" : null + } ], + "variables" : [ "test28489451d8", "b0a7672c-2802-45ec-a0e5-c7f601fcc6d5", "partitionkey202594", "rowkey88272bdb9", "dea79b44-d15d-45d5-9f3e-8b836c225509", "5b0f2001-9eee-49ec-9d42-f5581e2cb141", "b5682ac15fa447b7", "5d8f9dc0-c148-48bd-87f0-0ef93bb0f305", "208bfe9b-e6ab-4d29-a15c-35e8ab9bdebe" ] +} \ No newline at end of file diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/updateNonExistentEntity.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/updateNonExistentEntity.json new file mode 100644 index 000000000000..1921482bf009 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/test/resources/session-records/updateNonExistentEntity.json @@ -0,0 +1,94 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/Tables", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "f85c5603-c4c2-4628-b2ab-9854db6de12c", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 01 Jul 2020 12:52:40 GMT", + "Cache-Control" : "no-cache", + "x-ms-request-id" : "a7b42993-9002-00a7-2da6-4fbd3f000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables/@Element\",\"TableName\":\"test7868718213\"}", + "Preference-Applied" : "return-content", + "x-ms-client-request-id" : "f85c5603-c4c2-4628-b2ab-9854db6de12c", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8", + "Location" : "https://telboytrial.table.core.windows.net/Tables('test7868718213')" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.table.core.windows.net/test7868718213(PartitionKey='partitionkey887715',RowKey='rowkey611341888')?timeout=5000", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "624dcfdf-ac2b-4f98-baf6-1010bde0a052", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "404", + "x-ms-request-id" : "ad30c302-f002-0018-45a6-4f8a9a000000", + "Body" : "{\"odata.error\":{\"code\":\"ResourceNotFound\",\"message\":{\"lang\":\"en-US\",\"value\":\"The specified resource does not exist.\\nRequestId:ad30c302-f002-0018-45a6-4f8a9a000000\\nTime:2020-07-01T12:52:41.3508756Z\"}}}", + "Date" : "Wed, 01 Jul 2020 12:52:40 GMT", + "x-ms-client-request-id" : "624dcfdf-ac2b-4f98-baf6-1010bde0a052", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.table.core.windows.net/Tables?$format=application/json%3Bodata%3Dminimalmetadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "7ae89496-f8dc-431e-9124-65d13583c8c9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "093a81af-5002-005c-3aa6-4f00a5000000", + "Body" : "{\"odata.metadata\":\"https://telboytrial.table.core.windows.net/$metadata#Tables\",\"value\":[{\"TableName\":\"test7868718213\"}]}", + "Date" : "Wed, 01 Jul 2020 12:52:41 GMT", + "x-ms-client-request-id" : "7ae89496-f8dc-431e-9124-65d13583c8c9", + "Content-Type" : "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.table.core.windows.net/Tables('test7868718213')", + "Headers" : { + "x-ms-version" : "2019-02-02", + "x-ms-client-request-id" : "191e2e41-a9ef-46c1-af53-97ca8a73bb63" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "a7b42996-9002-00a7-2fa6-4fbd3f000000", + "Date" : "Wed, 01 Jul 2020 12:52:40 GMT", + "x-ms-client-request-id" : "191e2e41-a9ef-46c1-af53-97ca8a73bb63" + }, + "Exception" : null + } ], + "variables" : [ "test7868718213", "f85c5603-c4c2-4628-b2ab-9854db6de12c", "partitionkey887715", "rowkey611341888", "624dcfdf-ac2b-4f98-baf6-1010bde0a052", "7ae89496-f8dc-431e-9124-65d13583c8c9", "191e2e41-a9ef-46c1-af53-97ca8a73bb63" ] +} \ No newline at end of file diff --git a/sdk/template/azure-sdk-template/pom.xml b/sdk/template/azure-sdk-template/pom.xml index a8087f8d000b..4d9edccca439 100644 --- a/sdk/template/azure-sdk-template/pom.xml +++ b/sdk/template/azure-sdk-template/pom.xml @@ -31,7 +31,7 @@ com.azure azure-core - 1.6.0 + 1.7.0-beta.1 junit diff --git a/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md b/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md index 0f5364ca432a..8d503689eedd 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md +++ b/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md @@ -3,6 +3,9 @@ ## 1.1.0-beta.1 (Unreleased) +## 1.0.1 (2020-07-07) +- Update dependency version, `azure-core` to 1.6.0 and `azure-core-http-netty` to 1.5.3. + ## 1.0.0 (2020-06-09) - First stable release of `azure-ai-textanalytics`. diff --git a/sdk/textanalytics/azure-ai-textanalytics/README.md b/sdk/textanalytics/azure-ai-textanalytics/README.md index fd1cb6b396c2..5097a35032ff 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/README.md +++ b/sdk/textanalytics/azure-ai-textanalytics/README.md @@ -55,7 +55,7 @@ az cognitiveservices account create \ com.azure azure-ai-textanalytics - 1.0.0 + 1.0.1 ``` [//]: # ({x-version-update-end}) @@ -116,7 +116,7 @@ Authentication with AAD requires some initial setup: com.azure azure-identity - 1.0.6 + 1.0.8 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/textanalytics/azure-ai-textanalytics/pom.xml b/sdk/textanalytics/azure-ai-textanalytics/pom.xml index e4fe82eec1f4..b470a6d70bb7 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/pom.xml +++ b/sdk/textanalytics/azure-ai-textanalytics/pom.xml @@ -36,7 +36,7 @@ com.azure azure-core - 1.6.0 + 1.7.0-beta.1 com.azure @@ -88,7 +88,7 @@ com.azure azure-identity - 1.0.7 + 1.0.8 test